Merge "Make change tagging of edits in RecentChange::notifyNew/Edit"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 12 Feb 2016 02:46:31 +0000 (02:46 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 12 Feb 2016 02:46:31 +0000 (02:46 +0000)
1  2 
includes/page/WikiPage.php

@@@ -1636,6 -1636,9 +1636,9 @@@ class WikiPage implements Page, IDBAcce
         * @param User $user The user doing the edit
         * @param string $serialFormat Format for storing the content in the
         *   database.
+        * @param array|null $tags Change tags to apply to this edit
+        * Callers are responsible for permission checks
+        * (with ChangeTags::canAddTagsAccompanyingChange)
         *
         * @throws MWException
         * @return Status Possible errors:
         */
        public function doEditContent(
                Content $content, $summary, $flags = 0, $baseRevId = false,
-               User $user = null, $serialFormat = null
+               User $user = null, $serialFormat = null, $tags = null
        ) {
                global $wgUser, $wgUseAutomaticEditSummaries;
  
                        'oldContent' => $old_content,
                        'oldId' => $this->getLatest(),
                        'oldIsRedirect' => $this->isRedirect(),
-                       'oldCountable' => $this->isCountable()
+                       'oldCountable' => $this->isCountable(),
+                       'tags' => ( $tags !== null ) ? (array)$tags : array()
                );
  
                // Actually create the revision and create/update the page
                                        $oldContent ? $oldContent->getSize() : 0,
                                        $newsize,
                                        $revisionId,
-                                       $patrolled
+                                       $patrolled,
+                                       $meta['tags']
                                );
                        }
  
                                '',
                                $newsize,
                                $revisionId,
-                               $patrolled
+                               $patrolled,
+                               $meta['tags']
                        );
                }
  
         *   - 'no-change': don't update the article count, ever
         */
        public function doEditUpdates( Revision $revision, User $user, array $options = array() ) {
 -              global $wgRCWatchCategoryMembership;
 +              global $wgRCWatchCategoryMembership, $wgContLang;
  
                $options += array(
                        'changed' => true,
                        }
  
                        MessageCache::singleton()->replace( $shortTitle, $msgtext );
 +
 +                      if ( $wgContLang->hasVariants() ) {
 +                              $wgContLang->updateConversionTable( $this->mTitle );
 +                      }
                }
  
                if ( $options['created'] ) {
         *    success        : 'summary' (str), 'current' (rev), 'target' (rev)
         *
         * @param User $user The user performing the rollback
+        * @param array|null $tags Change tags to apply to the rollback
+        * Callers are responsible for permission checks
+        * (with ChangeTags::canAddTagsAccompanyingChange)
+        *
         * @return array Array of errors, each error formatted as
         *   array(messagekey, param1, param2, ...).
         * On success, the array is empty.  This array can also be passed to
         * OutputPage::showPermissionsErrorPage().
         */
        public function doRollback(
-               $fromP, $summary, $token, $bot, &$resultDetails, User $user
+               $fromP, $summary, $token, $bot, &$resultDetails, User $user, $tags = null
        ) {
                $resultDetails = null;
  
                        return $errors;
                }
  
-               return $this->commitRollback( $fromP, $summary, $bot, $resultDetails, $user );
+               return $this->commitRollback( $fromP, $summary, $bot, $resultDetails, $user, $tags );
        }
  
        /**
         *
         * @param array $resultDetails Contains result-specific array of additional values
         * @param User $guser The user performing the rollback
+        * @param array|null $tags Change tags to apply to the rollback
+        * Callers are responsible for permission checks
+        * (with ChangeTags::canAddTagsAccompanyingChange)
+        *
         * @return array
         */
-       public function commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser ) {
+       public function commitRollback( $fromP, $summary, $bot,
+               &$resultDetails, User $guser, $tags = null
+       ) {
                global $wgUseRCPatrol, $wgContLang;
  
                $dbw = wfGetDB( DB_MASTER );
                        $summary,
                        $flags,
                        $target->getId(),
-                       $guser
+                       $guser,
+                       null,
+                       $tags
                );
  
                // Set patrolling and bot flag on the edits, which gets rollbacked.
         * @param Title $title
         */
        public static function onArticleDelete( Title $title ) {
 +              global $wgContLang;
 +
                // Update existence markers on article/talk tabs...
                $other = $title->getOtherPage();
  
                // Messages
                if ( $title->getNamespace() == NS_MEDIAWIKI ) {
                        MessageCache::singleton()->replace( $title->getDBkey(), false );
 +
 +                      if ( $wgContLang->hasVariants() ) {
 +                              $wgContLang->updateConversionTable( $title );
 +                      }
                }
  
                // Images