Skip to content
Snippets Groups Projects
Commit 2dc22ea5 authored by Nathan Dentzau's avatar Nathan Dentzau Committed by Sascha Grossenbacher
Browse files

Issue #3033976 by nathandentzau: redirect_update_8103() fails when loading YAML config

parent c8e8d6d2
No related branches found
No related tags found
No related merge requests found
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
* Update hooks for the Redirect module. * Update hooks for the Redirect module.
*/ */
use Drupal\redirect\Entity\Redirect; use Drupal\Core\Config\FileStorage;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Drupal\redirect\Entity\Redirect;
use Drupal\system\Entity\Action; use Drupal\system\Entity\Action;
use Drupal\user\Entity\Role;
use Drupal\views\Entity\View; use Drupal\views\Entity\View;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Config\FileStorage;
use Drupal\user\Entity\Role;
/** /**
* Rehash redirects to account for case insensitivity. * Rehash redirects to account for case insensitivity.
...@@ -145,7 +145,7 @@ function redirect_update_8103() { ...@@ -145,7 +145,7 @@ function redirect_update_8103() {
// Only create if the redirect view doesn't exist and views is enabled. // Only create if the redirect view doesn't exist and views is enabled.
if (!View::load('redirect') && \Drupal::moduleHandler()->moduleExists('views')) { if (!View::load('redirect') && \Drupal::moduleHandler()->moduleExists('views')) {
$config_path = drupal_get_path('module', 'redirect') . '/config/install/views.view.redirect.yml'; $config_path = drupal_get_path('module', 'redirect') . '/config/install/views.view.redirect.yml';
$data = Yaml::parse($config_path); $data = Yaml::parse(file_get_contents($config_path));
\Drupal::configFactory()->getEditable('views.view.redirect')->setData($data)->save(TRUE); \Drupal::configFactory()->getEditable('views.view.redirect')->setData($data)->save(TRUE);
$message = 'The new redirect view has been created.'; $message = 'The new redirect view has been created.';
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment