From: Sergio Santoro Date: Sat, 25 Oct 2014 17:26:21 +0000 (+0200) Subject: SqlBagOStuff: reuse code of parent class X-Git-Tag: 1.31.0-rc.0~13473^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=807b24eb2768145421894c946bff211f300f7a39;p=lhc%2Fweb%2Fwiklou.git SqlBagOStuff: reuse code of parent class It'll be easier to change the time threshold (currently 10 years) in the future. Change-Id: I24005148d40c47905d5b20cfd506decef2ae447e --- diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index d8d86dbae3..3585e57b1a 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -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