Skip to content

Commit

Permalink
Refactoring retrieval of ini path in CI depends script; adding docblock.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuswilms authored and nateabele committed May 24, 2012
1 parent 7327c99 commit 1217042
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions tests/ci_depends.php
Expand Up @@ -14,7 +14,7 @@ class PhpExtensions {
/**
* Holds build, configure and install instructions for PHP extensions.
*
* @var array Extensions to build keyed by extension identifier.
* @var array Extensions to build keyed by extension name.
*/
protected $_extensions = array(
'memcached' => array(
Expand Down Expand Up @@ -59,22 +59,14 @@ class PhpExtensions {
);

/**
* After instantiation holds the path to loaded PHP configuration file.
* Install extension by given name.
*
* @see http://php.net/php_ini_loaded_file
* @var string Path to loaded PHP configuration file i.e. `/usr/local/php/php.ini`.
*/
protected $_iniPath;

/**
* Constructor.
* Uses configration retrieved as per `php_ini_loaded_file()`.
*
* @see http://php.net/php_ini_loaded_file
* @param string $name The name of the extension to install.
* @return void
*/
public function __construct() {
$this->_iniPath = php_ini_loaded_file();
}

public function install($name) {
if (array_key_exists($name, $this->_extensions)) {
$extension = $this->_extensions[$name];
Expand Down Expand Up @@ -102,7 +94,7 @@ public function install($name) {
$this->_system(sprintf($message, $folder, implode(' ', $extension['configure'])));

foreach ($extension['ini'] as $ini) {
$this->_system(sprintf("echo %s >> %s", $ini, $this->_iniPath));
$this->_system(sprintf("echo %s >> %s", $ini, php_ini_loaded_file()));
}
printf("=> installed (%s)\n", $folder);
}
Expand Down

0 comments on commit 1217042

Please sign in to comment.