From: mhutti1 Date: Tue, 15 Dec 2015 23:45:37 +0000 (+0100) Subject: Add tag parameter to API action=rollback X-Git-Tag: 1.31.0-rc.0~8651^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=5ee0f231eaece02b75fedb3f74c24a6907c4e937;p=lhc%2Fweb%2Fwiklou.git Add tag parameter to API action=rollback Added code to allow tag change in ApiRollback.php Bug: T111948 Change-Id: Ic8dcefe569f169041c9e0078a49af4ee87d2bbd6 --- 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