From 1bc2b88bb2021eca3fc25b61297a08e058dafb77 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 10 Sep 2016 22:36:50 +0200 Subject: [PATCH] Use Database::timestamp in LocalFile::loadFieldsWithTimestamp Postgres needs a special timestamp format on sql which is handled by Database::timestamp. Bug: T145066 Change-Id: I8db958ecbea7c12af8caf8354490e59500975e4b --- includes/filerepo/file/LocalFile.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index de3cdbeed3..d63a91b6a2 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -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_' ); } -- 2.20.1