Commit a2bc6f46 authored by alexpott's avatar alexpott

Issue #3075645 by chr.fritsch, maacl, super_romeo, volkerk, alexpott:...

Issue #3075645 by chr.fritsch, maacl, super_romeo, volkerk, alexpott: temporary://update-cache-60b12ec6 is not a directory. in FileSystem->scanDirectory()

(cherry picked from commit 44b124ac)
parent 1c8f0423
......@@ -385,6 +385,23 @@ public function testModulePageRunCron() {
$this->assertNoText(t('No update information available.'));
}
/**
* Checks that clearing the disk cache works.
*/
public function testClearDiskCache() {
$directories = [
_update_manager_cache_directory(FALSE),
_update_manager_extract_directory(FALSE),
];
// Check that update directories does not exists.
foreach ($directories as $directory) {
$this->assertDirectoryNotExists($directory);
}
// Method must not fail if update directories do not exists.
update_clear_update_disk_cache();
}
/**
* Checks the messages at admin/modules when the site is up to date.
*/
......
......@@ -806,7 +806,9 @@ function update_clear_update_disk_cache() {
// Search for files and directories in base folder only without recursion.
foreach ($directories as $directory) {
\Drupal::service('file_system')->scanDirectory($directory, '/.*/', ['callback' => 'update_delete_file_if_stale', 'recurse' => FALSE]);
if (is_dir($directory)) {
\Drupal::service('file_system')->scanDirectory($directory, '/.*/', ['callback' => 'update_delete_file_if_stale', 'recurse' => FALSE]);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment