SqlBagOStuff: reuse code of parent class
authorSergio Santoro <santoro.srg@gmail.com>
Sat, 25 Oct 2014 17:26:21 +0000 (19:26 +0200)
committerSergio Santoro <santoro.srg@gmail.com>
Sat, 25 Oct 2014 17:26:21 +0000 (19:26 +0200)
It'll be easier to change the time threshold (currently 10 years)
in the future.

Change-Id: I24005148d40c47905d5b20cfd506decef2ae447e

includes/objectcache/SqlBagOStuff.php

index d8d86db..3585e57 100644 (file)
@@ -322,9 +322,7 @@ class SqlBagOStuff extends BagOStuff {
                        if ( $exptime == 0 ) {
                                $encExpiry = $this->getMaxDateTime( $db );
                        } else {
-                               if ( $exptime < 3.16e8 ) { # ~10 years
-                                       $exptime += time();
-                               }
+                               $exptime = $this->convertExpiry( $exptime );
                                $encExpiry = $db->timestamp( $exptime );
                        }
                        foreach ( $serverKeys as $tableName => $tableKeys ) {
@@ -377,10 +375,7 @@ class SqlBagOStuff extends BagOStuff {
                        if ( $exptime == 0 ) {
                                $encExpiry = $this->getMaxDateTime( $db );
                        } else {
-                               if ( $exptime < 3.16e8 ) { # ~10 years
-                                       $exptime += time();
-                               }
-
+                               $exptime = $this->convertExpiry( $exptime );
                                $encExpiry = $db->timestamp( $exptime );
                        }
                        // (bug 24425) use a replace if the db supports it instead of
@@ -421,9 +416,7 @@ class SqlBagOStuff extends BagOStuff {
                        if ( $exptime == 0 ) {
                                $encExpiry = $this->getMaxDateTime( $db );
                        } else {
-                               if ( $exptime < 3.16e8 ) { # ~10 years
-                                       $exptime += time();
-                               }
+                               $exptime = $this->convertExpiry( $exptime );
                                $encExpiry = $db->timestamp( $exptime );
                        }
                        // (bug 24425) use a replace if the db supports it instead of