From a28c7f477bf81bd76f531879eeed836ae836d13e Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 23 Jul 2007 17:22:09 +0000 Subject: [PATCH] Fixed LocalRepo::cleanupDeletedBatch(), wasn't working --- includes/filerepo/LocalRepo.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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(); -- 2.20.1