Loading core/modules/update/src/UpdateRootFactory.php→core/modules/update/src/UpdateRoot.php +24 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /** * Gets the root path used by the Update Manager to install or update projects. */ class UpdateRootFactory { class UpdateRoot { /** * The Drupal kernel. Loading @@ -24,6 +24,13 @@ class UpdateRootFactory { */ protected $requestStack; /** * The update root. * * @var string */ protected $updateRoot; /** * Constructs an UpdateRootFactory instance. * Loading @@ -37,6 +44,16 @@ public function __construct(DrupalKernelInterface $drupal_kernel, RequestStack $ $this->requestStack = $request_stack; } /** * Sets the root path under which projects are installed or updated. * * @param string $update_root * The update root. */ public function set(string $update_root): void { $this->updateRoot = $update_root; } /** * Gets the root path under which projects are installed or updated. * Loading @@ -45,7 +62,12 @@ public function __construct(DrupalKernelInterface $drupal_kernel, RequestStack $ * * @return string */ public function get() { public function __toString(): string { // Return the $updateRoot when it is set. if (isset($this->updateRoot)) { return $this->updateRoot; } // Normally the Update Manager's root path is the same as the app root (the // directory in which the Drupal site is installed). $root_path = $this->drupalKernel->getAppRoot(); Loading core/modules/update/tests/src/Functional/UpdateTestBase.php +1 −2 Original line number Diff line number Diff line Loading @@ -63,8 +63,7 @@ protected function setUp() { // test child site. $request = \Drupal::request(); $update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request); $this->container->set('update.root', $update_root); \Drupal::setContainer($this->container); $this->container->get('update.root')->set($update_root); // Create the directories within the root path within which the Update // Manager will install projects. Loading core/modules/update/update.services.yml +1 −7 Original line number Diff line number Diff line Loading @@ -14,11 +14,5 @@ services: class: Drupal\update\UpdateFetcher arguments: ['@config.factory', '@http_client', '@settings'] update.root: class: SplString factory: ['@update.root.factory', 'get'] tags: - { name: parameter_service } update.root.factory: class: Drupal\update\UpdateRootFactory class: Drupal\update\UpdateRoot arguments: ['@kernel', '@request_stack'] public: false Loading
core/modules/update/src/UpdateRootFactory.php→core/modules/update/src/UpdateRoot.php +24 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /** * Gets the root path used by the Update Manager to install or update projects. */ class UpdateRootFactory { class UpdateRoot { /** * The Drupal kernel. Loading @@ -24,6 +24,13 @@ class UpdateRootFactory { */ protected $requestStack; /** * The update root. * * @var string */ protected $updateRoot; /** * Constructs an UpdateRootFactory instance. * Loading @@ -37,6 +44,16 @@ public function __construct(DrupalKernelInterface $drupal_kernel, RequestStack $ $this->requestStack = $request_stack; } /** * Sets the root path under which projects are installed or updated. * * @param string $update_root * The update root. */ public function set(string $update_root): void { $this->updateRoot = $update_root; } /** * Gets the root path under which projects are installed or updated. * Loading @@ -45,7 +62,12 @@ public function __construct(DrupalKernelInterface $drupal_kernel, RequestStack $ * * @return string */ public function get() { public function __toString(): string { // Return the $updateRoot when it is set. if (isset($this->updateRoot)) { return $this->updateRoot; } // Normally the Update Manager's root path is the same as the app root (the // directory in which the Drupal site is installed). $root_path = $this->drupalKernel->getAppRoot(); Loading
core/modules/update/tests/src/Functional/UpdateTestBase.php +1 −2 Original line number Diff line number Diff line Loading @@ -63,8 +63,7 @@ protected function setUp() { // test child site. $request = \Drupal::request(); $update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request); $this->container->set('update.root', $update_root); \Drupal::setContainer($this->container); $this->container->get('update.root')->set($update_root); // Create the directories within the root path within which the Update // Manager will install projects. Loading
core/modules/update/update.services.yml +1 −7 Original line number Diff line number Diff line Loading @@ -14,11 +14,5 @@ services: class: Drupal\update\UpdateFetcher arguments: ['@config.factory', '@http_client', '@settings'] update.root: class: SplString factory: ['@update.root.factory', 'get'] tags: - { name: parameter_service } update.root.factory: class: Drupal\update\UpdateRootFactory class: Drupal\update\UpdateRoot arguments: ['@kernel', '@request_stack'] public: false