From 76fc292ac856f857f2115592b8cccc9baff4d54e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 22 Jan 2012 03:25:19 +0000 Subject: [PATCH] Simplified last_modified timestamp conversion in SwiftFileBackend to just use wfTimestamp() --- includes/filerepo/backend/SwiftFileBackend.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index 197236a553..a9427f0992 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -440,17 +440,12 @@ class SwiftFileBackend extends FileBackend { try { $contObj = $this->getContainer( $srcCont ); $srcObj = $contObj->get_object( $srcRel, $this->headersFromParams( $params ) ); - // Convert dates like "Tue, 03 Jan 2012 22:01:04 GMT" to TS_MW - $date = DateTime::createFromFormat( 'D, d F Y G:i:s e', $srcObj->last_modified ); - if ( $date ) { - $stat = array( - 'mtime' => $date->format( 'YmdHis' ), - 'size' => $srcObj->content_length, - 'sha1' => $srcObj->metadata['Sha1base36'] - ); - } else { // exception will be caught below - throw new Exception( "Could not parse date for object {$srcRel}" ); - } + $stat = array( + // Convert dates like "Tue, 03 Jan 2012 22:01:04 GMT" to TS_MW + 'mtime' => wfTimestamp( TS_MW, $srcObj->last_modified ), + 'size' => $srcObj->content_length, + 'sha1' => $srcObj->metadata['Sha1base36'] + ); } catch ( NoSuchContainerException $e ) { } catch ( NoSuchObjectException $e ) { } catch ( InvalidResponseException $e ) { -- 2.20.1