Permalink
Browse files

Refactoring retrieval of ini path in CI depends script; adding docblock.

  • Loading branch information...
1 parent 7327c99 commit 1217042af9c456efed55819628d853c5a689d9a9 @davidpersson davidpersson committed with nateabele Apr 16, 2012
Showing with 6 additions and 14 deletions.
  1. +6 −14 tests/ci_depends.php
View
@@ -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(
@@ -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];
@@ -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);
}

0 comments on commit 1217042

Please sign in to comment.