<?php
/**
*
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @addtogroup SpecialPage
*/
/**
- *
+ * You will need the extension MogileClient to use this special page.
*/
-require_once( 'SpecialUpload.php' );
require_once( 'MogileFS.php' );
/**
$form->execute();
}
-/** @package MediaWiki */
+/**
+ * Extends Special:Upload with MogileFS.
+ * @addtogroup SpecialPage
+ */
class UploadFormMogile extends UploadForm {
/**
* Move the uploaded file from its temporary location to the final
if( $mfs->getPaths( $this->mSavedFile )) {
$this->mUploadOldVersion = gmdate( 'YmdHis' ) . "!{$saveName}";
if( !$mfs->rename( $this->mSavedFile, "archive!{$this->mUploadOldVersion}" ) ) {
- $wgOut->fileRenameError( $this->mSavedFile,
+ $wgOut->showFileRenameError( $this->mSavedFile,
"archive!{$this->mUploadOldVersion}" );
return false;
}
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);
/**
* 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;
}
}
}
-?>
+