Merge "Added a separate error message for mkdir failures"
[lhc/web/wiklou.git] / includes / filerepo / file / LocalFile.php
index a412250..33177d3 100644 (file)
@@ -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
@@ -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}";