X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiImageRotate.php;h=71bda6d7e498125742299a7ec7d46b5167a5eef2;hb=872dc01de3bfae0db3f952b75b95d98beb47449e;hp=72fb16d19ba404560ca4d8397fbdc4bd2ead5020;hpb=950b3f960aea995ab7c95b01519866a2a1c923ab;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index 72fb16d19b..71bda6d7e4 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -42,6 +42,14 @@ class ApiImageRotate extends ApiBase { 'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'interwikiTitles', ] ); + // Check if user can add tags + if ( count( $params['tags'] ) ) { + $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $this->getUser() ); + if ( !$ableToTag->isOK() ) { + $this->dieStatus( $ableToTag ); + } + } + foreach ( $pageSet->getTitles() as $title ) { $r = []; $r['id'] = $title->getArticleID(); @@ -104,8 +112,16 @@ class ApiImageRotate extends ApiBase { $comment = wfMessage( 'rotate-comment' )->numParams( $rotation )->inContentLanguage()->text(); - $status = $file->upload( $dstPath, - $comment, $comment, 0, false, false, $this->getUser() ); + $status = $file->upload( + $dstPath, + $comment, + $comment, + 0, + false, + false, + $this->getUser(), + $params['tags'] ?: [] + ); if ( $status->isGood() ) { $r['result'] = 'Success'; } else { @@ -157,6 +173,10 @@ class ApiImageRotate extends ApiBase { 'continue' => [ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', ], + 'tags' => [ + ApiBase::PARAM_TYPE => 'tags', + ApiBase::PARAM_ISMULTI => true, + ], ]; if ( $flags ) { $result += $this->getPageSet()->getFinalParams( $flags );