Use Database::timestamp in LocalFile::loadFieldsWithTimestamp
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 10 Sep 2016 20:36:50 +0000 (22:36 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 10 Sep 2016 20:36:50 +0000 (22:36 +0200)
Postgres needs a special timestamp format on sql which is handled by
Database::timestamp.

Bug: T145066
Change-Id: I8db958ecbea7c12af8caf8354490e59500975e4b

includes/filerepo/file/LocalFile.php

index de3cdbe..d63a91b 100644 (file)
@@ -431,16 +431,18 @@ class LocalFile extends File {
        private function loadFieldsWithTimestamp( $dbr, $fname ) {
                $fieldMap = false;
 
-               $row = $dbr->selectRow( 'image', $this->getLazyCacheFields( 'img_' ),
-                       [ 'img_name' => $this->getName(), 'img_timestamp' => $this->getTimestamp() ],
-                       $fname );
+               $row = $dbr->selectRow( 'image', $this->getLazyCacheFields( 'img_' ), [
+                               'img_name' => $this->getName(),
+                               'img_timestamp' => $dbr->timestamp( $this->getTimestamp() )
+                       ], $fname );
                if ( $row ) {
                        $fieldMap = $this->unprefixRow( $row, 'img_' );
                } else {
                        # File may have been uploaded over in the meantime; check the old versions
-                       $row = $dbr->selectRow( 'oldimage', $this->getLazyCacheFields( 'oi_' ),
-                               [ 'oi_name' => $this->getName(), 'oi_timestamp' => $this->getTimestamp() ],
-                               $fname );
+                       $row = $dbr->selectRow( 'oldimage', $this->getLazyCacheFields( 'oi_' ), [
+                                       'oi_name' => $this->getName(),
+                                       'oi_timestamp' => $dbr->timestamp( $this->getTimestamp() )
+                               ], $fname );
                        if ( $row ) {
                                $fieldMap = $this->unprefixRow( $row, 'oi_' );
                        }