52 $this->stash = $stash;
55 wfDebug( __METHOD__ .
" creating new UploadStash instance for " . $user->getId() );
57 wfDebug( __METHOD__ .
" creating new UploadStash instance with no user" );
60 $this->stash =
new UploadStash( $this->repo, $user );
62 parent::__construct();
82 return self::isValidKey( $request->getText(
'wpFileKey', $request->getText(
'wpSessionKey' ) ) );
90 public function initialize( $key, $name =
'upload_file', $initTempFile =
true ) {
97 $metadata = $this->stash->getMetadata( $key );
98 $tempPath = $initTempFile ? $this->
getRealPath( $metadata[
'us_path'] ) :
null;
99 if ( $tempPath ===
false ) {
104 $metadata[
'us_size'],
108 $this->mFileKey = $key;
109 $this->mVirtualTempPath = $metadata[
'us_path'];
110 $this->mFileProps = $this->stash->getFileProps( $key );
111 $this->mSourceType = $metadata[
'us_source_type'];
112 $this->mStashFile = $this->stash->getFile( $key );
120 $fileKey = $request->getText(
'wpFileKey', $request->getText(
'wpSessionKey' ) );
123 $desiredDestName = $request->getText(
125 $request->getText(
'wpUploadFile', $request->getText(
'filename' ) )
128 $this->
initialize( $fileKey, $desiredDestName );
146 if ( !is_array( $this->mFileProps ) ) {
147 throw new LogicException(
"mFileProps should never be null" );
149 return $this->mFileProps[
'sha1'];
158 $this->mStashFile =
null;
159 return $this->stash->removeFile( $this->mFileKey );
166 parent::postProcessUpload();
172class_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.