diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-09-03 04:51:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 04:51:18 +0300 |
commit | 3565da78bff718f201247fc2f692c0be29220fde (patch) | |
tree | e8268373b284c293c307935a8bfa20d5cd920b48 /core | |
parent | 21cafb0533d07acbe0a574e23bd972b20d72aa90 (diff) |
Updates php-di to 6.2.1 (#16311)
Diffstat (limited to 'core')
-rw-r--r-- | core/CliMulti/RequestCommand.php | 4 | ||||
-rw-r--r-- | core/Container/ContainerFactory.php | 2 | ||||
-rw-r--r-- | core/Container/IniConfigDefinitionSource.php | 24 | ||||
-rw-r--r-- | core/Container/StaticContainer.php | 2 | ||||
-rw-r--r-- | core/ExceptionHandler.php | 4 | ||||
-rw-r--r-- | core/bootstrap.php | 2 |
6 files changed, 27 insertions, 11 deletions
diff --git a/core/CliMulti/RequestCommand.php b/core/CliMulti/RequestCommand.php index bcdea2b5cc..49c521f31f 100644 --- a/core/CliMulti/RequestCommand.php +++ b/core/CliMulti/RequestCommand.php @@ -69,9 +69,9 @@ class RequestCommand extends ConsoleCommand if ($input->getOption('superuser')) { StaticContainer::addDefinitions(array( 'observers.global' => \DI\add(array( - array('Environment.bootstrapped', function () { + array('Environment.bootstrapped', \DI\value(function () { Access::getInstance()->setSuperUserAccess(true); - }) + })) )), )); } diff --git a/core/Container/ContainerFactory.php b/core/Container/ContainerFactory.php index 2d8d91dbc2..e556b721ae 100644 --- a/core/Container/ContainerFactory.php +++ b/core/Container/ContainerFactory.php @@ -10,7 +10,6 @@ namespace Piwik\Container; use DI\Container; use DI\ContainerBuilder; -use Doctrine\Common\Cache\ArrayCache; use Piwik\Application\Kernel\GlobalSettingsProvider; use Piwik\Application\Kernel\PluginList; use Piwik\Plugin\Manager; @@ -66,7 +65,6 @@ class ContainerFactory $builder = new ContainerBuilder(); $builder->useAnnotations(false); - $builder->setDefinitionCache(new ArrayCache()); // INI config $builder->addDefinitions(new IniConfigDefinitionSource($this->settings)); diff --git a/core/Container/IniConfigDefinitionSource.php b/core/Container/IniConfigDefinitionSource.php index a880cf58d0..753261f9d4 100644 --- a/core/Container/IniConfigDefinitionSource.php +++ b/core/Container/IniConfigDefinitionSource.php @@ -8,7 +8,7 @@ namespace Piwik\Container; -use DI\Definition\Exception\DefinitionException; +use DI\Definition\Exception\InvalidDefinition; use DI\Definition\Source\DefinitionSource; use DI\Definition\ValueDefinition; use Piwik\Application\Kernel\GlobalSettingsProvider; @@ -56,14 +56,30 @@ class IniConfigDefinitionSource implements DefinitionSource $section = $this->getSection($sectionName); if ($configKey === null) { - return new ValueDefinition($name, $section); + $value = new ValueDefinition($section); + $value->setName($name); + return $value; } if (! array_key_exists($configKey, $section)) { return null; } - return new ValueDefinition($name, $section[$configKey]); + $value = new ValueDefinition($section[$configKey]); + $value->setName($name); + return $value; + } + + public function getDefinitions(): array + { + $result = []; + foreach ($this->config as $section) { + $value = new ValueDefinition($this->getSection($section)); + $value->setName($section); + + $result[$section] = $value; + } + return $result; } private function parseEntryName($name) @@ -84,7 +100,7 @@ class IniConfigDefinitionSource implements DefinitionSource $section = $this->config->getSection($sectionName); if (!is_array($section)) { - throw new DefinitionException(sprintf( + throw new InvalidDefinition(sprintf( 'IniFileChain did not return an array for the config section %s', $section )); diff --git a/core/Container/StaticContainer.php b/core/Container/StaticContainer.php index 1100eb930b..7baf5b57d6 100644 --- a/core/Container/StaticContainer.php +++ b/core/Container/StaticContainer.php @@ -74,7 +74,7 @@ class StaticContainer * * @param string $name Container entry name. * @return mixed - * @throws \DI\NotFoundException + * @throws \DI\NotFoundException|\DI\DependencyException */ public static function get($name) { diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php index 3a59a74f0b..6cb9edbcc3 100644 --- a/core/ExceptionHandler.php +++ b/core/ExceptionHandler.php @@ -8,8 +8,8 @@ */ namespace Piwik; +use DI\DependencyException; use Exception; -use Interop\Container\Exception\ContainerException; use Piwik\API\Request; use Piwik\API\ResponseBuilder; use Piwik\Container\ContainerDoesNotExistException; @@ -159,7 +159,7 @@ class ExceptionHandler 'exception' => $exception, 'ignoreInScreenWriter' => true, ]); - } catch (ContainerException $ex) { + } catch (DependencyException $ex) { // ignore (occurs if exception is thrown when resolving DI entries) } catch (ContainerDoesNotExistException $ex) { // ignore diff --git a/core/bootstrap.php b/core/bootstrap.php index c777270728..028f7dcae6 100644 --- a/core/bootstrap.php +++ b/core/bootstrap.php @@ -43,6 +43,8 @@ require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; // Composer autoloader require_once PIWIK_VENDOR_PATH . '/autoload.php'; +require_once PIWIK_INCLUDE_PATH . '/DIObject.php'; + \Piwik\Plugin\Manager::initPluginDirectories(); /** |