37 parent::__construct( $main, $action );
38 $this->repoGroup = $repoGroup;
50 $rights = [
'reupload' ];
51 if ( $this->
getUser()->equals( $this->file->getUploader() ) ) {
53 array_unshift( $rights,
'reupload-own' );
57 $sourceUrl = $this->file->getArchiveVirtualUrl( $this->archiveName );
58 $status = $this->file->upload(
60 $this->params[
'comment'],
61 $this->params[
'comment'],
68 if ( $status->isGood() ) {
69 $result = [
'result' =>
'Success' ];
72 'result' =>
'Failure',
86 $title = Title::makeTitleSafe(
NS_FILE, $this->params[
'filename'] );
87 if ( $title ===
null ) {
92 $localRepo = $this->repoGroup->getLocalRepo();
95 $this->file = $localRepo->newFile( $title );
96 if ( !$this->file->exists() ) {
101 $this->archiveName = $this->params[
'archivename'];
103 $oldFile = $localRepo->newFromArchiveName( $title, $this->archiveName );
104 if ( !$oldFile->exists() ) {
123 ParamValidator::PARAM_TYPE =>
'string',
124 ParamValidator::PARAM_REQUIRED =>
true,
127 ParamValidator::PARAM_DEFAULT =>
'',
130 ParamValidator::PARAM_TYPE =>
'string',
131 ParamValidator::PARAM_REQUIRED =>
true,
144 'action=filerevert&filename=Wiki.png&comment=Revert&' .
145 'archivename=20110305152740!Wiki.png&token=123ABC'
146 =>
'apihelp-filerevert-example-revert',
152 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Filerevert';
157class_alias( ApiFileRevert::class,
'ApiFileRevert' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
This is the main API class, used for both external and internal processing.