From: Aaron Schulz Date: Fri, 11 Apr 2008 18:18:32 +0000 (+0000) Subject: Be consistent with filearchive system and use whole key. This is a modified version... X-Git-Tag: 1.31.0-rc.0~48439 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=41f4f126bc40800145c2414f05a0cbd0312de54c;p=lhc%2Fweb%2Fwiklou.git 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) --- 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" );