Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312173

Change subject: Use ConvertibleTimestamp::convert() in a few places
......................................................................

Use ConvertibleTimestamp::convert() in a few places

Change-Id: I9da31cd96fa7afa5cfccbbc204fb446fdb1a3c65
---
M includes/libs/rdbms/database/Database.php
M includes/libs/xmp/XMPValidate.php
2 files changed, 4 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/73/312173/1

diff --git a/includes/libs/rdbms/database/Database.php 
b/includes/libs/rdbms/database/Database.php
index d3c9d57..4f702c1 100644
--- a/includes/libs/rdbms/database/Database.php
+++ b/includes/libs/rdbms/database/Database.php
@@ -3458,13 +3458,7 @@
                        return 'infinity';
                }
 
-               try {
-                       $t = new ConvertibleTimestamp( $expiry );
-
-                       return $t->getTimestamp( $format );
-               } catch ( TimestampException $e ) {
-                       return false;
-               }
+               return ConvertibleTimestamp::convert( $format, $expiry );
        }
 
        public function setBigSelects( $value = true ) {
diff --git a/includes/libs/xmp/XMPValidate.php 
b/includes/libs/xmp/XMPValidate.php
index aaf6491..31eaa3b 100644
--- a/includes/libs/xmp/XMPValidate.php
+++ b/includes/libs/xmp/XMPValidate.php
@@ -329,15 +329,15 @@
                        // We know that if we got to this step, year, month day 
hour and min must be set
                        // by virtue of regex not failing.
 
-                       $unix = ( new ConvertibleTimestamp(
+                       $unix = ConvertibleTimestamp::convert( TS_UNIX,
                                $res[1] . $res[2] . $res[3] . $res[4] . $res[5] 
. $res[6]
-                       ) )->getTimestamp( TS_UNIX );
+                       );
                        $offset = intval( substr( $res[7], 1, 2 ) ) * 60 * 60;
                        $offset += intval( substr( $res[7], 4, 2 ) ) * 60;
                        if ( substr( $res[7], 0, 1 ) === '-' ) {
                                $offset = -$offset;
                        }
-                       $val = ( new ConvertibleTimestamp( $unix + $offset ) 
)->getTimestamp( TS_EXIF );
+                       $val = ConvertibleTimestamp::convert( TS_EXIF, $unix + 
$offset );
 
                        if ( $stripSeconds ) {
                                // If seconds weren't specified, remove the 
trailing ':00'.

-- 
To view, visit https://gerrit.wikimedia.org/r/312173
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9da31cd96fa7afa5cfccbbc204fb446fdb1a3c65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to