X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fobjectcache%2FSqlBagOStuff.php;h=3585e57b1a462cd5c781f8eff888880e1386ef7b;hb=4b63457dc72fd5aae828957c45297be30f21b0b7;hp=58720790d34c12d437aebc36b266183f34dd43a8;hpb=eea755d3babc7148de76efc0a74f700020ceaae2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index 58720790d3..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 @@ -621,7 +614,8 @@ class SqlBagOStuff extends BagOStuff { if ( $remainingSeconds > $totalSeconds ) { $totalSeconds = $remainingSeconds; } - $percent = ( $i + $remainingSeconds / $totalSeconds ) + $processedSeconds = $totalSeconds - $remainingSeconds; + $percent = ( $i + $processedSeconds / $totalSeconds ) / $this->shards * 100; } $percent = ( $percent / $this->numServers ) @@ -638,6 +632,11 @@ class SqlBagOStuff extends BagOStuff { return true; } + /** + * Delete content of shard tables in every server. + * Return true if the operation is successful, false otherwise. + * @return bool + */ public function deleteAll() { for ( $serverIndex = 0; $serverIndex < $this->numServers; $serverIndex++ ) { try {