Commit 4664d8af authored by webchick's avatar webchick

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

parent 36b646c2
......@@ -6,6 +6,8 @@
*/
namespace Drupal\Component\PhpStorage;
use Drupal\Component\Utility\Settings;
use Drupal\Core\StreamWrapper\PublicStream;
/**
......@@ -32,12 +34,12 @@ class PhpStorageFactory {
* An instantiated storage controller for the specified name.
*/
static function get($name) {
global $conf;
if (isset($conf['php_storage'][$name])) {
$configuration = $conf['php_storage'][$name];
$conf = Settings::getSingleton()->get('php_storage');
if (isset($conf[$name])) {
$configuration = $conf[$name];
}
elseif (isset($conf['php_storage']['default'])) {
$configuration = $conf['php_storage']['default'];
elseif (isset($conf['default'])) {
$configuration = $conf['default'];
}
else {
$configuration = array(
......
......@@ -7,6 +7,8 @@
namespace Drupal\Tests\Component\PhpStorage;
use Drupal\Component\Utility\Settings;
/**
* Tests the simple file storage.
*/
......@@ -21,7 +23,6 @@ public static function getInfo() {
}
public function setUp() {
global $conf;
parent::setUp();
$dir_path = sys_get_temp_dir() . '/php';
$conf['php_storage']['simpletest'] = array(
......@@ -34,6 +35,7 @@ public function setUp() {
// Let this read from the bin where the other instance is writing.
'bin' => 'simpletest',
);
new Settings($conf);
}
/**
......
......@@ -8,6 +8,7 @@
namespace Drupal\Tests\Component\PhpStorage;
use Drupal\Component\PhpStorage\PhpStorageFactory;
use Drupal\Component\Utility\Settings;
/**
* Tests the directory mtime based PHP loader implementation.
......@@ -33,7 +34,6 @@ public static function getInfo() {
}
function setUp() {
global $conf;
parent::setUp();
$this->secret = $this->randomName();
$conf['php_storage']['simpletest'] = array(
......@@ -41,6 +41,7 @@ function setUp() {
'directory' => sys_get_temp_dir() . '/php',
'secret' => $this->secret,
);
new Settings($conf);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment