private $repo;
/**
- * @param User|bool $user Default: false
+ * @param User|bool $user Default: false Sometimes this won't exist, as when running from cron.
* @param UploadStash|bool $stash Default: false
* @param FileRepo|bool $repo Default: false
*/
public function __construct( $user = false, $stash = false, $repo = false ) {
- // user object. sometimes this won't exist, as when running from cron.
- $this->user = $user;
-
if ( $repo ) {
$this->repo = $repo;
} else {
wfDebug( __METHOD__ . " creating new UploadStash instance with no user\n" );
}
- $this->stash = new UploadStash( $this->repo, $this->user );
+ $this->stash = new UploadStash( $this->repo, $user );
}
}
}
/**
- * @param WebRequest $request
+ * @param WebRequest &$request
*/
public function initializeFromRequest( &$request ) {
// sends wpSessionKey as a default when wpFileKey is missing
return $this->mFileProps['sha1'];
}
- /*
- * protected function verifyFile() inherited
- */
-
- /**
- * Stash the file.
- *
- * @param User $user
- * @return UploadStashFile
- */
- public function stashFile( User $user = null ) {
- // replace mLocalFile with an instance of UploadStashFile, which adds some methods
- // that are useful for stashed files.
- $this->mLocalFile = parent::stashFile( $user );
-
- return $this->mLocalFile;
- }
-
- /**
- * This should return the key instead of the UploadStashFile instance, for backward compatibility.
- * @return string
- */
- public function stashSession() {
- return $this->stashFile()->getFileKey();
- }
-
/**
* Remove a temporarily kept file stashed by saveTempUploadedFile().
* @return bool Success