Merge "DumpUploads: output local path instead of mwstore path"
[lhc/web/wiklou.git] / includes / api / ApiProtect.php
index f1c0121..d289060 100644 (file)
@@ -42,6 +42,17 @@ class ApiProtect extends ApiBase {
                        $this->dieUsageMsg( reset( $errors ) );
                }
 
+               $user = $this->getUser();
+               $tags = $params['tags'];
+
+               // Check if user can add tags
+               if ( !is_null( $tags ) ) {
+                       $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $tags, $user );
+                       if ( !$ableToTag->isOK() ) {
+                               $this->dieStatus( $ableToTag );
+                       }
+               }
+
                $expiry = (array)$params['expiry'];
                if ( count( $expiry ) != count( $params['protections'] ) ) {
                        if ( count( $expiry ) == 1 ) {
@@ -108,7 +119,8 @@ class ApiProtect extends ApiBase {
                        $expiryarray,
                        $cascade,
                        $params['reason'],
-                       $this->getUser()
+                       $user,
+                       $tags
                );
 
                if ( !$status->isOK() ) {
@@ -153,6 +165,10 @@ class ApiProtect extends ApiBase {
                                ApiBase::PARAM_DFLT => 'infinite',
                        ],
                        'reason' => '',
+                       'tags' => [
+                               ApiBase::PARAM_TYPE => 'tags',
+                               ApiBase::PARAM_ISMULTI => true,
+                       ],
                        'cascade' => false,
                        'watch' => [
                                ApiBase::PARAM_DFLT => false,