From 41f4f126bc40800145c2414f05a0cbd0312de54c Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 11 Apr 2008 18:18:32 +0000 Subject: [PATCH] Be consistent with filearchive system and use whole key. This is a modified version of 32267. (talked to brion about this, who reverted it earlier) --- includes/filerepo/LocalRepo.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index b2ef327d7d..f71cf706c6 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -50,10 +50,13 @@ class LocalRepo extends FSRepo { __METHOD__, array( 'FOR UPDATE' ) ); if( !$inuse ) { $sha1 = substr( $key, 0, strcspn( $key, '.' ) ); + $ext = substr( $key, strcspn($key,'.') + 1 ); + $ext = File::normalizeExtension($ext); $inuse = $dbw->selectField( 'oldimage', '1', - array( 'oi_sha1' => $sha1, - 'oi_deleted & '.File::DELETED_FILE => File::DELETED_FILE ), - __METHOD__, array( 'FOR UPDATE' ) ); + array( 'oi_sha1' => $sha1, + "oi_archive_name LIKE '%.{$ext}'", + 'oi_deleted & '.File::DELETED_FILE => File::DELETED_FILE ), + __METHOD__, array( 'FOR UPDATE' ) ); } if ( !$inuse ) { wfDebug( __METHOD__ . ": deleting $key\n" ); -- 2.20.1