Merge "Rename autonym for 'no' from 'norsk bokmål' to 'norsk'"
[lhc/web/wiklou.git] / includes / MergeHistory.php
index 441fe9e..48ff97b 100644 (file)
@@ -24,6 +24,8 @@
  *
  * @file
  */
+use Wikimedia\Timestamp\TimestampException;
+use Wikimedia\Rdbms\IDatabase;
 
 /**
  * Handles the backend logic of merging the histories of two
@@ -33,7 +35,7 @@
  */
 class MergeHistory {
 
-       /** @const int Maximum number of revisions that can be merged at once (avoid too much slave lag) */
+       /** @const int Maximum number of revisions that can be merged at once */
        const REVISION_LIMIT = 5000;
 
        /** @var Title Page from which history will be merged */
@@ -42,7 +44,7 @@ class MergeHistory {
        /** @var Title Page to which history will be merged */
        protected $dest;
 
-       /** @var DatabaseBase Database that we are using */
+       /** @var IDatabase Database that we are using */
        protected $dbw;
 
        /** @var MWTimestamp Maximum timestamp that we can use (oldest timestamp of dest) */
@@ -58,7 +60,6 @@ class MergeHistory {
        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
@@ -90,7 +91,8 @@ class MergeHistory {
                                        'revision',
                                        'MAX(rev_timestamp)',
                                        [
-                                               'rev_timestamp <= ' . $this->dbw->timestamp( $mwTimestamp ),
+                                               'rev_timestamp <= ' .
+                                                       $this->dbw->addQuotes( $this->dbw->timestamp( $mwTimestamp ) ),
                                                'rev_page' => $this->source->getArticleID()
                                        ],
                                        __METHOD__
@@ -118,7 +120,8 @@ class MergeHistory {
                                $this->timestampLimit = $lasttimestamp;
                        }
 
-                       $this->timeWhere = "rev_timestamp <= {$this->dbw->timestamp( $timeInsert )}";
+                       $this->timeWhere = "rev_timestamp <= " .
+                               $this->dbw->addQuotes( $this->dbw->timestamp( $timeInsert ) );
                } catch ( TimestampException $ex ) {
                        // The timestamp we got is screwed up and merge cannot continue
                        // This should be detected by $this->isValidMerge()