cvs: pear-core /PEAR Config.php
| From: | Greg Beaver | Date: | Sat, 14 Aug 2004 14:08:36 +0000 |
| Subject: | cvs: pear-core /PEAR Config.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-22896@lists.php.net to get a copy of this message | ||
cellog Sat Aug 14 10:08:36 2004 EDT
Modified files:
/pear-core/PEAR Config.php
Log:
fix channel-related configuration bugs
- configuration array reset to "true" in _encodeOutput()
- _channels array not reconstructed from existing config files
http://cvs.php.net/diff.php/pear-core/PEAR/Config.php?r1=1.53&r2=1.54&ty=u
Index: pear-core/PEAR/Config.php
diff -u pear-core/PEAR/Config.php:1.53 pear-core/PEAR/Config.php:1.54
--- pear-core/PEAR/Config.php:1.53 Sun Jul 4 00:25:08 2004
+++ pear-core/PEAR/Config.php Sat Aug 14 10:08:35 2004
@@ -17,7 +17,7 @@
// | Greg Beaver <cellog@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Config.php,v 1.53 2004/07/04 04:25:08 cellog Exp $
+// $Id: Config.php,v 1.54 2004/08/14 14:08:35 cellog Exp $
require_once 'PEAR.php';
require_once 'System.php';
@@ -527,10 +527,32 @@
}
$this->_decodeInput($data);
$this->configuration[$layer] = $data;
+ $this->_setupChannels();
return true;
}
// }}}
+ // {{{ _setupChannels()
+
+ /**
+ * Reads the existing configurations and creates the _channels array from it
+ */
+ function _setupChannels()
+ {
+ $set = array_flip(array_values($this->_channels));
+ foreach ($this->configuration as $layer => $data) {
+ $i = 1000;
+ if (isset($data['__channels'])) {
+ foreach ($data['__channels'] as $channel => $info) {
+ $set[$channel] = $i++;
+ }
+ }
+ }
+ $this->_channels = array_values(array_flip($set));
+ $this->setChannels($this->_channels);
+ }
+
+ // }}}
// {{{ mergeConfigFile(file, [override], [layer])
/**
@@ -568,6 +590,7 @@
} else {
$this->configuration[$layer] = PEAR_Config::arrayMergeRecursive($data,
$this->configuration[$layer]);
}
+ $this->_setupChannels();
return true;
}
@@ -732,7 +755,7 @@
foreach ($data as $key => $value) {
if ($key == '__channels') {
foreach ($data['__channels'] as $channel => $blah) {
- $data['__channels'][$channel] =
$this->_encodeOutput($data['__channels'][$channel]);
+ $this->_encodeOutput($data['__channels'][$channel]);
}
}
if (!isset($this->configuration_info[$key])) {
@@ -977,7 +1000,8 @@
foreach ($channels as $channel) {
$channel = strtolower($channel);
foreach ($this->layers as $layer) {
- if (!isset($this->configuration[$layer]['__channels'][$channel])) {
+ if (!isset($this->configuration[$layer]['__channels'][$channel])
+ ||
!is_array($this->configuration[$layer]['__channels'][$channel])) {
$this->configuration[$layer]['__channels'][$channel] = array();
}
}