* Entry point
*/
function wfSpecialUploadMogile() {
- global $wgRequest;
- $form = new UploadFormMogile( $wgRequest );
- $form->execute();
+ global $wgRequest;
+ $form = new UploadFormMogile( $wgRequest );
+ $form->execute();
}
/** @package MediaWiki */
* @param bool $useRename Not used in this implementation
*/
function saveUploadedFile( $saveName, $tempName, $useRename = false ) {
- global $wgUploadDirectory, $wgOut;
+ global $wgOut;
$mfs = MogileFS::NewMogileFS();
$this->mSavedFile = "image!{$saveName}";
if( $mfs->getPaths( $this->mSavedFile )) {
$this->mUploadOldVersion = gmdate( 'YmdHis' ) . "!{$saveName}";
- if( !$mfs->rename( $this->mSavedFile, "archive!{$this->mUploadOldVersion}" ) ) {
- $wgOut->fileRenameError( $this->mSavedFile,
+ if( !$mfs->rename( $this->mSavedFile, "archive!{$this->mUploadOldVersion}" ) ) {
+ $wgOut->showFileRenameError( $this->mSavedFile,
"archive!{$this->mUploadOldVersion}" );
return false;
}
} else {
$this->mUploadOldVersion = '';
}
-
+
if ( $this->mStashed ) {
if (!$mfs->rename($tempName,$this->mSavedFile)) {
- $wgOut->fileRenameError($tempName, $this->mSavedFile );
+ $wgOut->showFileRenameError($tempName, $this->mSavedFile );
return false;
}
} else {
if ( !$mfs->saveFile($this->mSavedFile,'normal',$tempName )) {
- $wgOut->fileCopyError( $tempName, $this->mSavedFile );
+ $wgOut->showFileCopyError( $tempName, $this->mSavedFile );
return false;
}
unlink($tempName);
$stash = 'stash!' . gmdate( "YmdHis" ) . '!' . $saveName;
$mfs = MogileFS::NewMogileFS();
if ( !$mfs->saveFile( $stash, 'normal', $tempName ) ) {
- $wgOut->fileCopyError( $tempName, $stash );
+ $wgOut->showFileCopyError( $tempName, $stash );
return false;
}
unlink($tempName);
return $stash;
}
-
+
/**
* Stash a file in a temporary directory for later processing,
* and save the necessary descriptive info into the session.
# Couldn't save the file.
return false;
}
-
+
$key = mt_rand( 0, 0x7fffffff );
$_SESSION['wsUploadData'][$key] = array(
'mUploadTempName' => $stash,
/**
* Remove a temporarily kept file stashed by saveTempUploadedFile().
* @access private
+ * @return success
*/
function unsaveUploadedFile() {
global $wgOut;
$mfs = MogileFS::NewMogileFS();
if ( ! $mfs->delete( $this->mUploadTempName ) ) {
- $wgOut->fileDeleteError( $this->mUploadTempName );
+ $wgOut->showFileDeleteError( $this->mUploadTempName );
+ return false;
+ } else {
+ return true;
}
}
}