<?php
+
+use MediaWiki\MediaWikiServices;
+
/**
* Backend for uploading files from chunks.
*
* @author Michael Dale
*/
class UploadFromChunks extends UploadFromFile {
+ /** @var LocalRepo */
+ private $repo;
+ /** @var UploadStash */
+ public $stash;
+ /** @var User */
+ public $user;
+
protected $mOffset;
protected $mChunkIndex;
protected $mFileKey;
protected $mVirtualTempPath;
- /** @var LocalRepo */
- private $repo;
+
+ /** @noinspection PhpMissingParentConstructorInspection */
/**
* Setup local pointers to stash, repo and user (similar to UploadFromStash)
*/
public function stashFile( User $user = null ) {
wfDeprecated( __METHOD__, '1.28' );
- $this->verifyChunk();
- return parent::stashFile( $user );
- }
- /**
- * @inheritDoc
- * @throws UploadChunkVerificationException
- * @deprecated since 1.28
- */
- public function stashFileGetKey() {
- wfDeprecated( __METHOD__, '1.28' );
- $this->verifyChunk();
- return parent::stashFileGetKey();
- }
-
- /**
- * @inheritDoc
- * @throws UploadChunkVerificationException
- * @deprecated since 1.28
- */
- public function stashSession() {
- wfDeprecated( __METHOD__, '1.28' );
$this->verifyChunk();
- return parent::stashSession();
+ return parent::stashFile( $user );
}
/**
// Get the file extension from the last chunk
$ext = FileBackend::extensionFromPath( $this->mVirtualTempPath );
// Get a 0-byte temp file to perform the concatenation at
- $tmpFile = TempFSFile::factory( 'chunkedupload_', $ext, wfTempDir() );
+ $tmpFile = MediaWikiServices::getInstance()->getTempFSFileFactory()
+ ->newTempFSFile( 'chunkedupload_', $ext );
$tmpPath = false; // fail in concatenate()
if ( $tmpFile ) {
// keep alive with $this