From 5ee0f231eaece02b75fedb3f74c24a6907c4e937 Mon Sep 17 00:00:00 2001 From: mhutti1 Date: Wed, 16 Dec 2015 00:45:37 +0100 Subject: [PATCH] Add tag parameter to API action=rollback Added code to allow tag change in ApiRollback.php Bug: T111948 Change-Id: Ic8dcefe569f169041c9e0078a49af4ee87d2bbd6 --- includes/api/ApiRollback.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 6a3346f49e..7037fb619a 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -59,6 +59,16 @@ class ApiRollback extends ApiBase { $pageObj = WikiPage::factory( $titleObj ); $summary = $params['summary']; $details = array(); + + // If change tagging was requested, check that the user is allowed to tag, + // and the tags are valid + if ( count( $params['tags'] ) ) { + $tagStatus = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); + if ( !$tagStatus->isOK() ) { + $this->dieStatus( $tagStatus ); + } + } + $retval = $pageObj->doRollback( $this->getRbUser( $params ), $summary, @@ -81,6 +91,10 @@ class ApiRollback extends ApiBase { // Watch pages $this->setWatch( $watch, $titleObj, 'watchrollback' ); + if ( count( $params['tags'] ) ) { + ChangeTags::addTags( $params['tags'], null, intval( $details['newid'] ), null, null ); + } + $info = array( 'title' => $titleObj->getPrefixedText(), 'pageid' => intval( $details['current']->getPage() ), @@ -107,6 +121,10 @@ class ApiRollback extends ApiBase { 'pageid' => array( ApiBase::PARAM_TYPE => 'integer' ), + 'tags' => array( + ApiBase::PARAM_TYPE => ChangeTags::listExplicitlyDefinedTags(), + ApiBase::PARAM_ISMULTI => true, + ), 'user' => array( ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true -- 2.20.1