Prevent write operations to database replicas.
[lhc/web/wiklou.git] / includes / MergeHistory.php
index cc589c9..b969e03 100644 (file)
@@ -24,6 +24,7 @@
  *
  * @file
  */
+use MediaWiki\MediaWikiServices;
 use Wikimedia\Timestamp\TimestampException;
 use Wikimedia\Rdbms\IDatabase;
 
@@ -56,11 +57,10 @@ class MergeHistory {
        /** @var MWTimestamp|bool Timestamp upto which history from the source will be merged */
        protected $timestampLimit;
 
-       /** @var integer Number of revisions merged (for Special:MergeHistory success message) */
+       /** @var int Number of revisions merged (for Special:MergeHistory success message) */
        protected $revisionsMerged;
 
        /**
-        * MergeHistory constructor.
         * @param Title $source Page from which history will be merged
         * @param Title $dest Page to which history will be merged
         * @param string|bool $timestamp Timestamp up to which history from the source will be merged
@@ -336,6 +336,10 @@ class MergeHistory {
                }
                $this->dest->invalidateCache(); // update histories
 
+               // Duplicate watchers of the old article to the new article on history merge
+               $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+               $store->duplicateAllAssociatedEntries( $this->source, $this->dest );
+
                // Update our logs
                $logEntry = new ManualLogEntry( 'merge', 'merge' );
                $logEntry->setPerformer( $user );