diff core/modules/update/update.manager.inc @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
line wrap: on
line diff
--- a/core/modules/update/update.manager.inc	Thu Feb 28 13:21:36 2019 +0000
+++ b/core/modules/update/update.manager.inc	Thu May 09 15:33:08 2019 +0100
@@ -36,6 +36,8 @@
  * root.
  */
 
+use Drupal\Core\Url;
+use Drupal\Core\File\Exception\FileException;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 
 /**
@@ -58,7 +60,7 @@
   elseif ($success) {
     \Drupal::messenger()->addStatus(t('Updates downloaded successfully.'));
     $_SESSION['update_manager_update_projects'] = $results['projects'];
-    return new RedirectResponse(\Drupal::url('update.confirmation_page', [], ['absolute' => TRUE]));
+    return new RedirectResponse(Url::fromRoute('update.confirmation_page', [], ['absolute' => TRUE])->toString());
   }
   else {
     // Ideally we're catching all Exceptions, so they should never see this,
@@ -165,7 +167,12 @@
 
   $extract_location = $directory . '/' . $project;
   if (file_exists($extract_location)) {
-    file_unmanaged_delete_recursive($extract_location);
+    try {
+      \Drupal::service('file_system')->deleteRecursive($extract_location);
+    }
+    catch (FileException $e) {
+      // Ignore failed deletes.
+    }
   }
 
   $archiver->extract($directory);
@@ -213,7 +220,7 @@
 
   // Check the cache and download the file if needed.
   $cache_directory = _update_manager_cache_directory();
-  $local = $cache_directory . '/' . drupal_basename($parsed_url['path']);
+  $local = $cache_directory . '/' . \Drupal::service('file_system')->basename($parsed_url['path']);
 
   if (!file_exists($local) || update_delete_file_if_stale($local)) {
     return system_retrieve_file($url, $local, FALSE, FILE_EXISTS_REPLACE);
@@ -305,7 +312,7 @@
   // Compare the owner of a webserver-created temporary file to the owner of
   // the configuration directory to determine if local transfers will be
   // allowed.
-  $temporary_file = drupal_tempnam('temporary://', 'update_');
+  $temporary_file = \Drupal::service('file_system')->tempnam('temporary://', 'update_');
   $site_path = \Drupal::service('site.path');
   $local_transfers_allowed = fileowner($temporary_file) === fileowner($site_path);