Skip to content
Snippets Groups Projects
Commit 4664d8af authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2113621 by catch, ParisLiakos: Convert PhpStorageFactory from global to settings.

parent 36b646c2
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
*/ */
namespace Drupal\Component\PhpStorage; namespace Drupal\Component\PhpStorage;
use Drupal\Component\Utility\Settings;
use Drupal\Core\StreamWrapper\PublicStream; use Drupal\Core\StreamWrapper\PublicStream;
/** /**
...@@ -32,12 +34,12 @@ class PhpStorageFactory { ...@@ -32,12 +34,12 @@ class PhpStorageFactory {
* An instantiated storage controller for the specified name. * An instantiated storage controller for the specified name.
*/ */
static function get($name) { static function get($name) {
global $conf; $conf = Settings::getSingleton()->get('php_storage');
if (isset($conf['php_storage'][$name])) { if (isset($conf[$name])) {
$configuration = $conf['php_storage'][$name]; $configuration = $conf[$name];
} }
elseif (isset($conf['php_storage']['default'])) { elseif (isset($conf['default'])) {
$configuration = $conf['php_storage']['default']; $configuration = $conf['default'];
} }
else { else {
$configuration = array( $configuration = array(
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
namespace Drupal\Tests\Component\PhpStorage; namespace Drupal\Tests\Component\PhpStorage;
use Drupal\Component\Utility\Settings;
/** /**
* Tests the simple file storage. * Tests the simple file storage.
*/ */
...@@ -21,7 +23,6 @@ public static function getInfo() { ...@@ -21,7 +23,6 @@ public static function getInfo() {
} }
public function setUp() { public function setUp() {
global $conf;
parent::setUp(); parent::setUp();
$dir_path = sys_get_temp_dir() . '/php'; $dir_path = sys_get_temp_dir() . '/php';
$conf['php_storage']['simpletest'] = array( $conf['php_storage']['simpletest'] = array(
...@@ -34,6 +35,7 @@ public function setUp() { ...@@ -34,6 +35,7 @@ public function setUp() {
// Let this read from the bin where the other instance is writing. // Let this read from the bin where the other instance is writing.
'bin' => 'simpletest', 'bin' => 'simpletest',
); );
new Settings($conf);
} }
/** /**
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\Tests\Component\PhpStorage; namespace Drupal\Tests\Component\PhpStorage;
use Drupal\Component\PhpStorage\PhpStorageFactory; use Drupal\Component\PhpStorage\PhpStorageFactory;
use Drupal\Component\Utility\Settings;
/** /**
* Tests the directory mtime based PHP loader implementation. * Tests the directory mtime based PHP loader implementation.
...@@ -33,7 +34,6 @@ public static function getInfo() { ...@@ -33,7 +34,6 @@ public static function getInfo() {
} }
function setUp() { function setUp() {
global $conf;
parent::setUp(); parent::setUp();
$this->secret = $this->randomName(); $this->secret = $this->randomName();
$conf['php_storage']['simpletest'] = array( $conf['php_storage']['simpletest'] = array(
...@@ -41,6 +41,7 @@ function setUp() { ...@@ -41,6 +41,7 @@ function setUp() {
'directory' => sys_get_temp_dir() . '/php', 'directory' => sys_get_temp_dir() . '/php',
'secret' => $this->secret, 'secret' => $this->secret,
); );
new Settings($conf);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment