return empty( $this->mFileSize );
}
+ /*
+ * getRealPath
+ * @param string $srcPath the source path
+ * @returns the real path if it was a virtual url
+ */
+ function getRealPath( $srcPath ){
+ $repo = RepoGroup::singleton()->getLocalRepo();
+ if ( $repo->isVirtualUrl( $srcPath ) ) {
+ return $repo->resolveVirtualUrl( $srcPath );
+ }
+ return $srcPath;
+ }
+
/**
* Verify whether the upload is sane.
* Returns self::OK or else an array with error information
return true;
}
}
- /*
- * getRealPath
- * @param string $srcPath the source path
- * @returns the real path if it was a virtual url
- */
- function getRealPath( $srcPath ){
- $repo = RepoGroup::singleton()->getLocalRepo();
- if ( $repo->isVirtualUrl( $srcPath ) ) {
- return $repo->resolveVirtualUrl( $srcPath );
- }
- return $srcPath;
- }
// pretty ugly inter-mixing of mParam and local vars
function setupChunkSession( $summary, $comment, $watch ) {
/**
* @file
* @ingroup upload
- *
+ *
* Implements uploading from previously stored file.
- *
+ *
* @author Bryan Tong Minh
*/
-
+
class UploadFromStash extends UploadBase {
public static function isValidSessionKey( $key, $sessionData ) {
- return !empty( $key ) &&
- is_array( $sessionData ) &&
- isset( $sessionData[$key] ) &&
- isset( $sessionData[$key]['version'] ) &&
+ return !empty( $key ) &&
+ is_array( $sessionData ) &&
+ isset( $sessionData[$key] ) &&
+ isset( $sessionData[$key]['version'] ) &&
$sessionData[$key]['version'] == self::SESSION_VERSION;
}
public static function isValidRequest( $request ) {
$sessionData = $request->getSessionData( 'wsUploadData' );
- return self::isValidSessionKey(
+ return self::isValidSessionKey(
$request->getInt( 'wpSessionKey' ),
$sessionData
);
* them in the session on the server and just give
* an opaque key to the user agent.
*/
-
- $repo = RepoGroup::singleton()->getLocalRepo();
+
parent::initialize( $name,
- $repo->resolveVirtualUrl( $sessionData['mTempPath'] ),
+ $this->getRealPath ( $sessionData['mTempPath'] ),
$sessionData['mFileSize'],
false
);