X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Ffilerepo%2Ffile%2FLocalFile.php;h=33177d3f6fb9f3c742f3c254e3db2b18e2cd6534;hb=64b83bdb3afd0ee4f8fc1893a865409c198e601e;hp=e1c2546d6b6510d89cb89b09e79804419ce3a0ed;hpb=8ddf721b6feaf11c67aafc1445d255e68faa4007;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index e1c2546d6b..33177d3f6f 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -215,7 +215,6 @@ class LocalFile extends File { } /** - * Constructor. * Do not call this except from inside a repo class. * @param Title $title * @param FileRepo $repo @@ -593,7 +592,7 @@ class LocalFile extends File { if ( $upgrade ) { $this->upgrading = true; // Defer updates unless in auto-commit CLI mode - DeferredUpdates::addCallableUpdate( function() { + DeferredUpdates::addCallableUpdate( function () { $this->upgrading = false; // avoid duplicate updates try { $this->upgradeRow(); @@ -1032,9 +1031,15 @@ class LocalFile extends File { $purgeList = []; foreach ( $files as $file ) { - # Check that the base file name is part of the thumb name + if ( $this->repo->supportsSha1URLs() ) { + $reference = $this->getSha1(); + } else { + $reference = $this->getName(); + } + + # Check that the reference (filename or sha1) is part of the thumb name # This is a basic sanity check to avoid erasing unrelated directories - if ( strpos( $file, $this->getName() ) !== false + if ( strpos( $file, $reference ) !== false || strpos( $file, "-thumbnail" ) !== false // "short" thumb name ) { $purgeList[] = "{$dir}/{$file}";