34 parent::__construct( $main, $action );
46 $rights = [
'reupload' ];
47 if ( $this->
getUser()->equals( $this->file->getUploader() ) ) {
49 array_unshift( $rights,
'reupload-own' );
53 $sourceUrl = $this->file->getArchiveVirtualUrl( $this->archiveName );
54 $status = $this->file->upload(
56 $this->params[
'comment'],
57 $this->params[
'comment'],
64 if ( $status->isGood() ) {
65 $result = [
'result' =>
'Success' ];
68 'result' =>
'Failure',
82 $title = Title::makeTitleSafe(
NS_FILE, $this->params[
'filename'] );
83 if ( $title ===
null ) {
88 $localRepo = $this->repoGroup->getLocalRepo();
91 $this->file = $localRepo->newFile( $title );
92 if ( !$this->file->exists() ) {
97 $this->archiveName = $this->params[
'archivename'];
98 $oldFile = $localRepo->newFromArchiveName( $title, $this->archiveName );
99 if ( !$oldFile->exists() ) {
118 ParamValidator::PARAM_TYPE =>
'string',
119 ParamValidator::PARAM_REQUIRED =>
true,
122 ParamValidator::PARAM_DEFAULT =>
'',
125 ParamValidator::PARAM_TYPE =>
'string',
126 ParamValidator::PARAM_REQUIRED =>
true,
139 'action=filerevert&filename=Wiki.png&comment=Revert&' .
140 'archivename=20110305152740!Wiki.png&token=123ABC'
141 =>
'apihelp-filerevert-example-revert',
147 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Filerevert';
152class_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.