From e34f3c9664b5e939e9dee1f61f34cb9580403026 Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Thu, 8 Dec 2016 11:26:37 -0800 Subject: [PATCH] Remove PHP 5.4+ array syntax Former-commit-id: 3313379dd3854423d4acbf937ca0f55aedf80ffe Former-commit-id: 5038fd08d8ad0e359c12667653f8fb6cd38f38ff --- web/concrete/src/System/Info.php | 38 ++++++++++++++------------------ 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/web/concrete/src/System/Info.php b/web/concrete/src/System/Info.php index 1246c331852..9a57e2b4ea1 100644 --- a/web/concrete/src/System/Info.php +++ b/web/concrete/src/System/Info.php @@ -60,10 +60,8 @@ class Info public function __construct() { - $currentLocale = Localization::activeLocale(); - if ($currentLocale != 'en_US') { - Localization::changeLocale('en_US'); - } + $loc = Localization::getInstance(); + $loc->pushActiveContext('system'); try { $app = Facade::getFacadeApplication(); $config = $app->make('config'); @@ -76,14 +74,14 @@ public function __construct() $this->coreRootDirectory = DIR_BASE_CORE; - $versions = ['Core Version - '.$config->get('concrete.version')]; + $versions = array('Core Version - '.$config->get('concrete.version')); if ($this->installed) { $versions[] = 'Version Installed - '.$config->get('concrete.version_installed'); } $versions[] = 'Database Version - '.$config->get('concrete.version_db'); $this->coreVersions = implode("\n", $versions); - $packages = []; + $packages = array(); if ($this->installed) { foreach (PackageList::get()->getPackages() as $p) { if ($p->isPackageInstalled()) { @@ -101,7 +99,7 @@ public function __construct() $this->overrides = implode(', ', $overrides); } - $cache = [ + $cache = array( sprintf('Block Cache - %s', $config->get('concrete.cache.blocks') ? 'On' : 'Off'), sprintf('Overrides Cache - %s', $config->get('concrete.cache.overrides') ? 'On' : 'Off'), sprintf('Full Page Caching - %s', @@ -115,7 +113,7 @@ public function __construct() 'Off' ) ), - ]; + ); if ($config->get('concrete.cache.full_page_lifetime')) { $cache[] = sprintf("Full Page Cache Lifetime - %s", $config->get('concrete.cache.full_page_lifetime') == 'default' ? @@ -152,7 +150,7 @@ public function __construct() ob_start(); phpinfo(); $buffer = ob_get_clean(); - $phpinfo = []; + $phpinfo = array(); if ($app->isRunThroughCommandLineInterface()) { $section = null; foreach (preg_split('/[\r\n]+/', $buffer) as $line) { @@ -171,30 +169,30 @@ public function __construct() break; default: if ($section !== null) { - $phpinfo[$section][$chunks[0]] = [$chunks[1], $chunks[2]]; + $phpinfo[$section][$chunks[0]] = array($chunks[1], $chunks[2]); } break; } } } else { $section = 'phpinfo'; - $phpinfo[$section] = []; + $phpinfo[$section] = array(); if (preg_match_all('#(?:

(?:)?(.*?)(?:)?

)|(?:(.*?)\s*(?:(.*?)\s*(?:(.*?)\s*)?)?)#s', $buffer, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { if ($match[1] !== null && $match[1] !== '') { $section = $match[1]; - $phpinfo[$section] = []; + $phpinfo[$section] = array(); } elseif (isset($match[3])) { - $phpinfo[$section][$match[2]] = isset($match[4]) ? [$match[3], $match[4]] : $match[3]; + $phpinfo[$section][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; } else { $phpinfo[$section][] = $match[2]; } } } } - $phpSettings = [ + $phpSettings = array( "max_execution_time - $maxExecutionTime", - ]; + ); foreach ($phpinfo as $name => $section) { foreach ($section as $key => $val) { if (preg_match('/.*max_execution_time*/', $key)) { @@ -213,13 +211,10 @@ public function __construct() } } $this->phpSettings = implode("\n", $phpSettings); - if ($currentLocale != 'en_US') { - Localization::changeLocale($currentLocale); - } + + $loc->popActiveContext(); } catch (\Exception $x) { - if ($currentLocale != 'en_US') { - Localization::changeLocale($currentLocale); - } + $loc->popActiveContext(); throw $x; } } @@ -344,4 +339,5 @@ public function getJSONOBject() $o->coreVersions = $this->coreVersions; return $o; } + }