function update_post_update_clear_disk_cache

Removes the legacy 'Update Manager' disk cache.

File

core/modules/update/update.post_update.php, line 23

Code

function update_post_update_clear_disk_cache() : void {
  // @see _update_manager_unique_id()
  $id = substr(hash('sha256', Settings::getHashSalt()), 0, 8);
  // List of legacy 'Update Manager' cache directories.
  $directories = [
    // @see _update_manager_cache_directory()
"temporary://update-cache-{$id}",
    // @see _update_manager_extract_directory()
"temporary://update-extraction-{$id}",
  ];
  foreach ($directories as $directory) {
    if (is_dir($directory)) {
      \Drupal::service('file_system')->deleteRecursive($directory);
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.