Simplified last_modified timestamp conversion in SwiftFileBackend to just use wfTimes...
authorAaron Schulz <aaron@users.mediawiki.org>
Sun, 22 Jan 2012 03:25:19 +0000 (03:25 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sun, 22 Jan 2012 03:25:19 +0000 (03:25 +0000)
includes/filerepo/backend/SwiftFileBackend.php

index 197236a..a9427f0 100644 (file)
@@ -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 ) {