cvs: pear /Config/Config Container.php
| From: | Bertrand Mansion | Date: | Sun, 09 Feb 2003 18:48:20 +0000 |
| Subject: | cvs: pear /Config/Config Container.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8776@lists.php.net to get a copy of this message | ||
mansion Sun Feb 9 13:48:20 2003 EDT
Modified files:
/pear/Config/Config Container.php
Log:
Added php tags in case we generate a PHP array config.
Suggested by Laurent Laville.
Index: pear/Config/Config/Container.php
diff -u pear/Config/Config/Container.php:1.11 pear/Config/Config/Container.php:1.12
--- pear/Config/Config/Container.php:1.11 Tue Dec 17 12:12:30 2002
+++ pear/Config/Config/Container.php Sun Feb 9 13:48:20 2003
@@ -15,7 +15,7 @@
// | Author: Bertrand Mansion <bmansion@mamasam.com> |
// +---------------------------------------------------------------------+
//
-// $Id: Container.php,v 1.11 2002/12/17 17:12:30 mansion Exp $
+// $Id: Container.php,v 1.12 2003/02/09 18:48:20 mansion Exp $
require_once('Config.php');
@@ -506,9 +506,6 @@
*/
function writeDatasrc($datasrc, $configType = '', $options = array())
{
- // Check for a writeDatasrc($datasrc, $configType, $options, &$obj) method in plugin
- // untested !
-
$configType = strtolower($configType);
if (!Config::isConfigTypeRegistered($configType)) {
return PEAR::raiseError("Configuration type '$configType' is not
registered in Config_Container::writeDatasrc.", null, PEAR_ERROR_RETURN);
@@ -524,7 +521,13 @@
// Default behaviour
$fp = @fopen($datasrc, 'w');
if ($fp) {
- $string = $this->toString($configType, $options);
+ switch ($configType) {
+ case 'phparray':
+ $string = "<?php\n". $this->toString($configType, $options)
."?>";
+ break;
+ default:
+ $string = $this->toString($configType, $options);
+ }
$len = strlen($string);
@flock($fp, LOCK_EX);
@fwrite($fp, $string, $len);