51 parent::__construct( $main, $action );
52 $this->repoGroup = $repoGroup;
64 $rights = [
'reupload' ];
65 if ( $this->
getUser()->equals( $this->file->getUploader() ) ) {
67 array_unshift( $rights,
'reupload-own' );
71 $sourceUrl = $this->file->getArchiveVirtualUrl( $this->archiveName );
72 $status = $this->file->upload(
74 $this->params[
'comment'],
75 $this->params[
'comment'],
82 if ( $status->isGood() ) {
83 $result = [
'result' =>
'Success' ];
86 'result' =>
'Failure',
100 $title = Title::makeTitleSafe(
NS_FILE, $this->params[
'filename'] );
101 if ( $title ===
null ) {
106 $localRepo = $this->repoGroup->getLocalRepo();
109 $this->file = $localRepo->newFile( $title );
110 if ( !$this->file->exists() ) {
115 $this->archiveName = $this->params[
'archivename'];
117 $oldFile = $localRepo->newFromArchiveName( $title, $this->archiveName );
118 if ( !$oldFile->exists() ) {
134 ParamValidator::PARAM_TYPE =>
'string',
135 ParamValidator::PARAM_REQUIRED =>
true,
138 ParamValidator::PARAM_DEFAULT =>
'',
141 ParamValidator::PARAM_TYPE =>
'string',
142 ParamValidator::PARAM_REQUIRED =>
true,
153 'action=filerevert&filename=Wiki.png&comment=Revert&' .
154 'archivename=20110305152740!Wiki.png&token=123ABC'
155 =>
'apihelp-filerevert-example-revert',
160 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Filerevert';
165class_alias( ApiFileRevert::class,
'ApiFileRevert' );
wfEscapeWikiText( $input)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Local file in the wiki's own database.
This is the main API class, used for both external and internal processing.
Prioritized list of file repositories.