From: Tim Starling Date: Mon, 23 Jul 2007 17:22:09 +0000 (+0000) Subject: Fixed LocalRepo::cleanupDeletedBatch(), wasn't working X-Git-Tag: 1.31.0-rc.0~51981 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=a28c7f477bf81bd76f531879eeed836ae836d13e;p=lhc%2Fweb%2Fwiklou.git Fixed LocalRepo::cleanupDeletedBatch(), wasn't working --- diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 57b1872d47..ae56aa901b 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -44,13 +44,17 @@ class LocalRepo extends FSRepo { $hashPath = $this->getDeletedHashPath( $key ); $path = "$root/$hashPath$key"; $dbw->begin(); - $inuse = $dbw->select( 'filearchive', '1', + $inuse = $dbw->selectField( 'filearchive', '1', array( 'fa_storage_group' => 'deleted', 'fa_storage_key' => $key ), __METHOD__, array( 'FOR UPDATE' ) ); - if ( !$inuse && !unlink( $path ) ) { - $status->error( 'undelete-cleanup-error', $path ); - $status->failCount++; + if ( !$inuse ) { + wfDebug( __METHOD__ . ": deleting $key\n" ); + if ( !@unlink( $path ) ) { + $status->error( 'undelete-cleanup-error', $path ); + $status->failCount++; + } } else { + wfDebug( __METHOD__ . ": $key still in use\n" ); $status->successCount++; } $dbw->commit();