54 $this->stash = $stash;
57 wfDebug( __METHOD__ .
" creating new UploadStash instance for " . $user->getId() );
59 wfDebug( __METHOD__ .
" creating new UploadStash instance with no user" );
62 $this->stash =
new UploadStash( $this->repo, $user );
64 parent::__construct();
90 public function initialize( $key, $name =
'upload_file', $initTempFile =
true ) {
94 $metadata = $this->stash->getMetadata( $key );
95 $tempPath = $initTempFile ? $this->
getRealPath( $metadata[
'us_path'] ) :
null;
96 if ( $tempPath ===
false ) {
101 $metadata[
'us_size'],
105 $this->mFileKey = $key;
106 $this->mVirtualTempPath = $metadata[
'us_path'];
107 $this->mFileProps = $this->stash->getFileProps( $key );
108 $this->mSourceType = $metadata[
'us_source_type'];
109 $this->mStashFile = $this->stash->getFile( $key );
118 $fileKey =
$request->getText(
'wpFileKey',
$request->getText(
'wpSessionKey' ) );
121 $desiredDestName =
$request->getText(
126 $this->
initialize( $fileKey, $desiredDestName );
144 if ( !is_array( $this->mFileProps ) ) {
145 throw new LogicException(
"mFileProps should never be null" );
147 return $this->mFileProps[
'sha1'];
156 $this->mStashFile =
null;
157 return $this->stash->removeFile( $this->mFileKey );
164 parent::postProcessUpload();
170class_alias( UploadFromStash::class,
'UploadFromStash' );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.