Skip to content

Commit

Permalink
SW-7946 - Set php settings during kernel construction.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcremer committed Feb 10, 2014
1 parent 40c6bce commit e1508d9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions engine/Library/Enlight/Application.php
Expand Up @@ -349,6 +349,7 @@ public static function Instance()
* This method sets the configuration of the options parameter into the different configurations.
* If the options are not an array, the loadConfig method should be used to convert the options into an array.
*
* @deprecated 4.2
* @param array $options
* @return Enlight_Application
*/
Expand Down Expand Up @@ -406,6 +407,7 @@ public function getOption($key, $default = null)
/**
* Sets the php settings from the config
*
* @deprecated 4.2
* @param array $settings
* @param string $prefix
* @return Enlight_Application
Expand All @@ -426,6 +428,7 @@ public function setPhpSettings(array $settings, $prefix = '')
/**
* Sets include paths
*
* @deprecated 4.2
* @param array $paths
* @return Enlight_Application
*/
Expand Down
2 changes: 2 additions & 0 deletions engine/Shopware/Components/ConfigLoader.php
Expand Up @@ -99,6 +99,8 @@ public function loadConfig($file)
);
}

$config = array_change_key_case($config, CASE_LOWER);

return $config;
}

Expand Down
24 changes: 23 additions & 1 deletion engine/Shopware/Kernel.php
Expand Up @@ -103,6 +103,10 @@ public function __construct($environment, $debug)
$this->name = 'Shopware';

$this->initializeConfig();

if (!empty($this->config['phpsettings'])) {
$this->setPhpSettings($this->config['phpsettings']);
}
}

/**
Expand Down Expand Up @@ -261,6 +265,24 @@ protected function initializeConfig()
define("_MPDF_TTFONTDATAPATH", $this->getRootDir() .'/cache/mpdf/ttfontdata/');
}

/**
* Sets the php settings from the config
*
* @param array $settings
* @param string $prefix
*/
public function setPhpSettings(array $settings, $prefix = '')
{
foreach ($settings as $key => $value) {
$key = empty($prefix) ? $key : $prefix . $key;
if (is_scalar($value)) {
ini_set($key, $value);
} elseif (is_array($value)) {
$this->setPhpSettings($value, $key . '.');
}
}
}

/**
* Creates a new instance of the Shopware application
*/
Expand Down Expand Up @@ -538,6 +560,6 @@ public function getConfig()
*/
public function getHttpCacheConfig()
{
return is_array($this->config['httpCache']) ? $this->config['httpCache'] : array();
return is_array($this->config['httpcache']) ? $this->config['httpcache'] : array();
}
}

0 comments on commit e1508d9

Please sign in to comment.