jenkins-bot has submitted this change and it was merged. Change subject: API: Deprecate use of ApiPurge via GET ......................................................................
API: Deprecate use of ApiPurge via GET This emits a warning and logs feature usage, and also pretends that POST is required in the help and paraminfo output. Bug: T145649 Change-Id: Ied8d47a947662158fddab383c764bf70c5ab0112 --- M includes/api/ApiPurge.php 1 file changed, 18 insertions(+), 0 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/api/ApiPurge.php b/includes/api/ApiPurge.php index 5d1352c..8bbd88d 100644 --- a/includes/api/ApiPurge.php +++ b/includes/api/ApiPurge.php @@ -37,6 +37,12 @@ * 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, [], [] ); @@ -158,6 +164,18 @@ 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; + } + public function getAllowedParams( $flags = 0 ) { $result = [ 'forcelinkupdate' => false, -- To view, visit https://gerrit.wikimedia.org/r/310560 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ied8d47a947662158fddab383c764bf70c5ab0112 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Gergő Tisza <gti...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits