Go to the documentation of this file.
58 wfDebug( __METHOD__ .
" creating new UploadStash instance for " . $user->getId() .
"\n" );
60 wfDebug( __METHOD__ .
" creating new UploadStash instance with no user\n" );
63 $this->stash =
new UploadStash( $this->repo, $user );
84 return self::isValidKey( $request->getText(
'wpFileKey', $request->getText(
'wpSessionKey' ) ) );
92 public function initialize( $key, $name =
'upload_file', $initTempFile =
true ) {
99 $metadata = $this->stash->getMetadata( $key );
101 $initTempFile ? $this->
getRealPath( $metadata[
'us_path'] ) :
false,
102 $metadata[
'us_size'],
106 $this->mFileKey = $key;
107 $this->mVirtualTempPath = $metadata[
'us_path'];
108 $this->mFileProps = $this->stash->getFileProps( $key );
109 $this->mSourceType = $metadata[
'us_source_type'];
117 $fileKey = $request->getText(
'wpFileKey', $request->getText(
'wpSessionKey' ) );
120 $desiredDestName = $request->getText(
122 $request->getText(
'wpUploadFile', $request->getText(
'filename' ) )
125 $this->
initialize( $fileKey, $desiredDestName );
140 return $this->mFileProps[
'sha1'];
148 return $this->stash->removeFile( $this->mFileKey );
155 parent::postProcessUpload();
initializeFromRequest(&$request)
getTempFileSha1Base36()
Get the base 36 SHA1 of the file.
UploadStash is intended to accomplish a few things:
Implements uploading from previously stored file.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
postProcessUpload()
Remove the database record after a successful upload.
unsaveUploadedFile()
Remove a temporarily kept file stashed by saveTempUploadedFile().
__construct( $user=false, $stash=false, $repo=false)
static isValidRequest( $request)
initializePathInfo( $name, $tempPath, $fileSize, $removeTempFile=false)
Initialize the path information.
initialize( $key, $name='upload_file', $initTempFile=true)