function update_clear_update_disk_cache
Same name and namespace in other branches
- 7.x modules/update/update.module \update_clear_update_disk_cache()
- 9 core/modules/update/update.module \update_clear_update_disk_cache()
- 8.9.x core/modules/update/update.module \update_clear_update_disk_cache()
- 10 core/modules/update/update.module \update_clear_update_disk_cache()
Clears the temporary files and directories based on file age from disk.
Deprecated
in drupal:11.2.0 and is removed from drupal:12.0.0. There is no replacement. Use composer to manage the code for your site.
See also
https://www.drupal.org/node/3522119
1 call to update_clear_update_disk_cache()
- UpdateManagerTest::testClearDiskCache in core/
modules/ update/ tests/ src/ Functional/ UpdateManagerTest.php - Checks that clearing the disk cache works.
File
-
core/
modules/ update/ update.module, line 361
Code
function update_clear_update_disk_cache() : void {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. There is no replacement. Use composer to manage the code for your site. See https://www.drupal.org/node/3522119', E_USER_DEPRECATED);
// List of update module cache directories. Do not create the directories if
// they do not exist.
$directories = [
_update_manager_cache_directory(FALSE),
_update_manager_extract_directory(FALSE),
];
// Search for files and directories in base folder only without recursion.
foreach ($directories as $directory) {
if (is_dir($directory)) {
\Drupal::service('file_system')->scanDirectory($directory, '/.*/', [
'callback' => 'update_delete_file_if_stale',
'recurse' => FALSE,
]);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.