X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiPurge.php;h=83227a2fc2d83c5b0f8748834b7db3c32ea48bbc;hb=b1795df3ccd3daea9b588249a0b4a373c89ec618;hp=8bbd88dfec4684ffde5e6516633382fe1b51534a;hpb=c78b40508091c176c060c47bc91b36de1af7bcd7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php index 8bbd88dfec..83227a2fc2 100644 --- a/includes/api/ApiPurge.php +++ b/includes/api/ApiPurge.php @@ -37,12 +37,6 @@ class ApiPurge extends ApiBase { * Purges the cache of a page */ public function execute() { - $main = $this->getMain(); - if ( !$main->isInternalMode() && !$main->getRequest()->wasPosted() ) { - $this->logFeatureUsage( 'purge-via-GET' ); - $this->setWarning( 'Use of action=purge via GET is deprecated. Use POST instead.' ); - } - $params = $this->extractRequestParams(); $continuationManager = new ApiContinuationManager( $this, [], [] ); @@ -61,16 +55,11 @@ class ApiPurge extends ApiBase { ApiQueryBase::addTitleInfo( $r, $title ); $page = WikiPage::factory( $title ); if ( !$user->pingLimiter( 'purge' ) ) { - $flags = WikiPage::PURGE_ALL; - if ( !$this->getRequest()->wasPosted() ) { - $flags ^= WikiPage::PURGE_GLOBAL_PCACHE; // skip DB_MASTER write - } // Directly purge and skip the UI part of purge() - $page->doPurge( $flags ); + $page->doPurge(); $r['purged'] = true; } else { - $error = $this->parseMsg( [ 'actionthrottledtext' ] ); - $this->setWarning( $error['info'] ); + $this->addWarning( 'apierror-ratelimited' ); } if ( $forceLinkUpdate || $forceRecursiveLinkUpdate ) { @@ -114,8 +103,7 @@ class ApiPurge extends ApiBase { } } } else { - $error = $this->parseMsg( [ 'actionthrottledtext' ] ); - $this->setWarning( $error['info'] ); + $this->addWarning( 'apierror-ratelimited' ); $forceLinkUpdate = false; } } @@ -160,20 +148,7 @@ class ApiPurge extends ApiBase { } public function mustBePosted() { - // Anonymous users are not allowed a non-POST request - return !$this->getUser()->isAllowed( 'purge' ); - } - - protected function getHelpFlags() { - $flags = parent::getHelpFlags(); - - // Claim that we must be posted for the purposes of help and paraminfo. - // @todo Remove this when self::mustBePosted() is updated for T145649 - if ( !in_array( 'mustbeposted', $flags, true ) ) { - $flags[] = 'mustbeposted'; - } - - return $flags; + return true; } public function getAllowedParams( $flags = 0 ) { @@ -201,6 +176,6 @@ class ApiPurge extends ApiBase { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Purge'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Purge'; } }