Merge "Add tags support to patrol, protect, unblock, and undelete"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 3 Mar 2016 16:28:45 +0000 (16:28 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 3 Mar 2016 16:28:45 +0000 (16:28 +0000)
1  2 
includes/page/WikiPage.php

@@@ -2261,7 -2261,6 +2261,7 @@@ class WikiPage implements Page, IDBAcce
                                DeferredUpdates::addUpdate( $update );
                        }
                        if ( $wgRCWatchCategoryMembership
 +                              && $this->getContentHandler()->supportsCategories() === true
                                && ( $options['changed'] || $options['created'] )
                                && !$options['restored']
                        ) {
         * @param int &$cascade Set to false if cascading protection isn't allowed.
         * @param string $reason
         * @param User $user The user updating the restrictions
-        * @return Status
+        * @param string|string[] $tags Change tags to add to the pages and protection log entries
+        *   ($user should be able to add the specified tags before this is called)
+        * @return Status Status object; if action is taken, $status->value is the log_id of the
+        *   protection log entry.
         */
        public function doUpdateRestrictions( array $limit, array $expiry,
-               &$cascade, $reason, User $user
+               &$cascade, $reason, User $user, $tags = null
        ) {
                global $wgCascadingRestrictionLevels, $wgContLang;
  
                $logRelationsField = null;
                $logParamsDetails = [];
  
+               // Null revision (used for change tag insertion)
+               $nullRevision = null;
                if ( $id ) { // Protection of existing page
                        if ( !Hooks::run( 'ArticleProtect', [ &$this, &$user, $limit, $reason ] ) ) {
                                return Status::newGood();
                $logEntry->setComment( $reason );
                $logEntry->setPerformer( $user );
                $logEntry->setParameters( $params );
+               if ( !is_null( $nullRevision ) ) {
+                       $logEntry->setAssociatedRevId( $nullRevision->getId() );
+               }
+               $logEntry->setTags( $tags );
                if ( $logRelationsField !== null && count( $logRelationsValues ) ) {
                        $logEntry->setRelations( [ $logRelationsField => $logRelationsValues ] );
                }
                $logId = $logEntry->insert();
                $logEntry->publish( $logId );
  
-               return Status::newGood();
+               return Status::newGood( $logId );
        }
  
        /**