/**
* Return the associated title object
+ * @return Title
*/
public function getTitle() { return $this->title; }
/**
* Return true if the file is vectorized
*/
- public function isVectorized() {
- $handler = $this->getHandler();
- if ( $handler ) {
- return $handler->isVectorized( $this );
- } else {
- return false;
- }
- }
+ public function isVectorized() {
+ $handler = $this->getHandler();
+ if ( $handler ) {
+ return $handler->isVectorized( $this );
+ } else {
+ return false;
+ }
+ }
/**
* - File exists with normalized extension
* - The file looks like a thumbnail and the original exists
*
- * @param $file The File object to check
+ * @param $file File The File object to check
* @return mixed False if the file does not exists, else an array
*/
public static function getExistsWarning( $file ) {
}
public function initialize( $name, $sessionKey, $sessionData ) {
- /**
- * Confirming a temporarily stashed upload.
- * We don't want path names to be forged, so we keep
- * them in the session on the server and just give
- * an opaque key to the user agent.
- */
+ /**
+ * Confirming a temporarily stashed upload.
+ * We don't want path names to be forged, so we keep
+ * them in the session on the server and just give
+ * an opaque key to the user agent.
+ */
- $this->initializePathInfo( $name,
- $this->getRealPath ( $sessionData['mTempPath'] ),
- $sessionData['mFileSize'],
- false
- );
-
- $this->mSessionKey = $sessionKey;
- $this->mVirtualTempPath = $sessionData['mTempPath'];
- $this->mFileProps = $sessionData['mFileProps'];
- $this->mSourceType = isset( $sessionData['mSourceType'] ) ?
- $sessionData['mSourceType'] : null;
+ $this->initializePathInfo( $name,
+ $this->getRealPath ( $sessionData['mTempPath'] ),
+ $sessionData['mFileSize'],
+ false
+ );
+
+ $this->mSessionKey = $sessionKey;
+ $this->mVirtualTempPath = $sessionData['mTempPath'];
+ $this->mFileProps = $sessionData['mFileProps'];
+ $this->mSourceType = isset( $sessionData['mSourceType'] ) ?
+ $sessionData['mSourceType'] : null;
}
public function initializeFromRequest( &$request ) {
return parent::performUpload( $comment, $pageText, $watch, $user );
}
-
+ /**
+ * @param $comment
+ * @param $pageText
+ * @param $watch
+ * @param $user User
+ * @return
+ */
protected function insertJob( $comment, $pageText, $watch, $user ) {
$sessionKey = $this->stashSession();
$job = new UploadFromUrlJob( $this->getTitle(), array(
return true;
}
-
/**
* List all files in the stash.
*/
public function listFiles() {
return array_keys( $_SESSION[UploadBase::SESSION_KEYNAME] );
}
-
/**
* Find or guess extension -- ensuring that our extension matches our mime type.
throw new UploadStashFileNotFoundException( 'cannot find path, or not a plain file' );
}
-
-
parent::__construct( false, $repo, $path, false );
$this->name = basename( $this->path );
return SpecialPage::getTitleFor( 'UploadStash', $subPage )->getLocalURL();
}
-
/**
* Get a URL to access the thumbnail
* This is required because the model of how files work requires that
return $this->getUrl();
}
-
/**
* Getter for session key (the session-unique id by which this file's location & metadata is stored in the session)
*