Add missing Database::timestamp() calls
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 29 Oct 2016 16:16:39 +0000 (09:16 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 29 Oct 2016 20:47:03 +0000 (20:47 +0000)
This was broken for Postgres installations

Change-Id: I0c1d442e3cf1d9a4d5359e7a8f8fd02a31d1ac65

includes/MergeHistory.php
includes/WatchedItemQueryService.php

index f797fe3..e57f880 100644 (file)
@@ -90,7 +90,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 +119,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()
index 8497224..b7cdc53 100644 (file)
@@ -442,11 +442,13 @@ class WatchedItemQueryService {
 
                if ( isset( $options['start'] ) ) {
                        $after = $options['dir'] === self::DIR_OLDER ? '<=' : '>=';
-                       $conds[] = 'rc_timestamp ' . $after . ' ' . $db->addQuotes( $options['start'] );
+                       $conds[] = 'rc_timestamp ' . $after . ' ' .
+                               $db->addQuotes( $db->timestamp( $options['start'] ) );
                }
                if ( isset( $options['end'] ) ) {
                        $before = $options['dir'] === self::DIR_OLDER ? '>=' : '<=';
-                       $conds[] = 'rc_timestamp ' . $before . ' ' . $db->addQuotes( $options['end'] );
+                       $conds[] = 'rc_timestamp ' . $before . ' ' .
+                               $db->addQuotes( $db->timestamp( $options['end'] ) );
                }
 
                return $conds;