/** * Delete a list of thumbnails visible at urls * @param string $dir base dir of the files. * @param array $files of strings: relative filenames (to $dir) */ protected function purgeThumbList($dir, $files) { $fileListDebug = strtr(var_export($files, true), array("\n" => '')); wfDebug(__METHOD__ . ": {$fileListDebug}\n"); $purgeList = array(); foreach ($files as $file) { # Check that the base file name is part of the thumb name # This is a basic sanity check to avoid erasing unrelated directories if (strpos($file, $this->getName()) !== false || strpos($file, "-thumbnail") !== false) { $purgeList[] = "{$dir}/{$file}"; } } # Delete the thumbnails $this->repo->quickPurgeBatch($purgeList); # Clear out the thumbnail directory if empty $this->repo->quickCleanDir($dir); }