*
* @param int $serverIndex
* @return DatabaseBase
+ * @throws MWException
*/
protected function getDB( $serverIndex ) {
global $wgDebugDBTransactions;
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 ) {
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
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
/**
* @param string $key
- * @param int $time
* @return bool
*/
- public function delete( $key, $time = 0 ) {
+ public function delete( $key ) {
list( $serverIndex, $tableName ) = $this->getTableByKey( $key );
try {
$db = $this->getDB( $serverIndex );
if ( $remainingSeconds > $totalSeconds ) {
$totalSeconds = $remainingSeconds;
}
- $percent = ( $i + $remainingSeconds / $totalSeconds )
+ $processedSeconds = $totalSeconds - $remainingSeconds;
+ $percent = ( $i + $processedSeconds / $totalSeconds )
/ $this->shards * 100;
}
$percent = ( $percent / $this->numServers )
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 {