/**
* Represents a temporary filestore, with metadata in the database.
- * Designed to be compatible with the session stashing code in UploadBase (should replace it eventually)
+ * Designed to be compatible with the session stashing code in UploadBase
+ * (should replace it eventually).
*
* @param $repo FileRepo
+ * @param $user User (default null)
*/
public function __construct( FileRepo $repo, $user = null ) {
// this might change based on wiki's configuration.
}
}
// at this point, $error should contain the single "most important" error, plus any parameters.
- throw new UploadStashFileException( "Error storing file in '$path': " . wfMessage( $error )->text() );
+ $errorMsg = array_shift( $error );
+ throw new UploadStashFileException( "Error storing file in '$path': " . wfMessage( $errorMsg, $error )->text() );
}
$stashPath = $storeStatus->value;
+ // we have renamed the file so we have to cleanup once done
+ unlink($path);
+
// fetch the current user ID
if ( !$this->isLoggedIn ) {
throw new UploadStashNotLoggedInException( __METHOD__ . ' No user is logged in, files must belong to users' );
* Helper function: do the actual database query to fetch file metadata.
*
* @param $key String: key
+ * @param $readFromDB: constant (default: DB_SLAVE)
* @return boolean
*/
protected function fetchFileMetadata( $key, $readFromDB = DB_SLAVE ) {
/**
* Helper function: Initialize the UploadStashFile for a given file.
*
- * @param $path String: path to file
* @param $key String: key under which to store the object
* @throws UploadStashZeroLengthFileException
* @return bool
/**
* Helper function -- given a 'subpage', return the local URL e.g. /wiki/Special:UploadStash/subpage
- * @param {String} $subPage
- * @return {String} local URL for this subpage in the Special:UploadStash space.
+ * @param $subPage String
+ * @return String: local URL for this subpage in the Special:UploadStash space.
*/
private function getSpecialUrl( $subPage ) {
return SpecialPage::getTitleFor( 'UploadStash', $subPage )->getLocalURL();