51 parent::__construct( $main, $action );
52 $this->repoGroup = $repoGroup;
65 $sourceUrl = $this->file->getArchiveVirtualUrl( $this->archiveName );
66 $status = $this->file->upload(
68 $this->params[
'comment'],
69 $this->params[
'comment'],
76 if ( $status->isGood() ) {
77 $result = [
'result' =>
'Success' ];
80 'result' =>
'Failure',
94 $title = Title::makeTitleSafe(
NS_FILE, $this->params[
'filename'] );
95 if ( $title ===
null ) {
100 $localRepo = $this->repoGroup->getLocalRepo();
103 $this->file = $localRepo->newFile( $title );
104 if ( !$this->file->exists() ) {
109 $this->archiveName = $this->params[
'archivename'];
111 $oldFile = $localRepo->newFromArchiveName( $title, $this->archiveName );
112 if ( !$oldFile->exists() ) {
128 ParamValidator::PARAM_TYPE =>
'string',
129 ParamValidator::PARAM_REQUIRED =>
true,
132 ParamValidator::PARAM_DEFAULT =>
'',
135 ParamValidator::PARAM_TYPE =>
'string',
136 ParamValidator::PARAM_REQUIRED =>
true,
147 'action=filerevert&filename=Wiki.png&comment=Revert&' .
148 'archivename=20110305152740!Wiki.png&token=123ABC'
149 =>
'apihelp-filerevert-example-revert',
154 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Filerevert';
159class_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.