La premier chose constaté c'est la commande "pear help" sans la fenêtre dos ne fonctionne pas ce qui est normale car dans le dossier "c:/wamp/bin/php/php5.2.7" il n'y a pas de fichier "pear help" ni de "help".Citation
1) Nettoyage par le vide
-tu effaces tous les fichiers en rapport avec Pear dans ton répertoire C:\wamp\bin\php\php5.2.6 excepté le fichier go-pear.bat issu de la distribution mais que nous n'emploierons pas
-tu effaces tous les fichiers du répertoire C:\wamp\bin\php\php5.2.6\PEAR sauf go-pear.phar pour la même raison que précédemment
2)Installation de base
-tu récupères le fichier go-pear.php sur le site de pear ([pear.php.net]) et tu l'enregistres dans le répertoire www de wamp
-dans ton navigateur tu tapes localhost/go-pear.php
-tu suis à la lettre les instructions (il n'y a rien à faire sauf valider à chaque fois
-lorsque l'installation est terminée tu double clique sur le fichier PEAR_ENV.reg afin enregistrer les variables d'environnement
-tu modifies ton httpd.conf comme ceci:
<IfModule alias_module>
...
ScriptAlias /cgi-bin/ "cgi-bin/"
Alias /pear/ "c:/wamp/bin/php/php5.2.7/PEAR/"
</IfModule>
<Directory "c:/wamp/bin/php/php5.2.7/PEAR/">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
-tu modifies ton php.ini de cette manière (chercher la ligne ou se trouve le include_path:
include_path = ".;c:\wamp\bin\php\php5.2.7\PEAR"
-tu fais un Restart All Services afin que Wamp prenne en compte les modifs
3)Gestion des packages
A partir de maintenant tu peux et il faut utiliser les lignes de commandes pour mettre à jour tes packages, les installer les desinstaller...
Pour cela tu vas dans le menu Démarrer de Windows puis dans Programmes et Accessoires et tu lances Invite de commandes :
-tu te places dans le répertoire ou se situe pear en tapant : cd c:/wamp/bin/php/php5.2.7
-si tu désires connaître toutes les commandes tu tapes "pear help"
-si tu désires installer un packages tu tapes "pear install le-nom-du-paquet"
-si tu désires mettre à jour un paquet : "pear upgrade le-nom-du-paquet"
-si tu désires lister les packages du cannel par défaut : "pear liste-packages"
...
A toi d'essayer les différentes commandes et si tu es perdu pense à : "pear help "
Citation
Notice: Use of undefined constant PEAR_CONFIG_SYSCONFDIR - assumed 'PEAR_CONFIG_SYSCONFDIR' in C:\wamp\www\PEAR\pearfrontendweb.php on line 72
Warning: Can not find config file, please specify the $pear_user_config variable in /index.php
Error: the template directory (C:\php5\pear\data\PEAR_Frontend_Web\data\templates) is not a directory, or not readable. Make sure the 'data_dir' of your config file (C:\php5\pear\data) points to the correct location !
<?php /** +----------------------------------------------------------------------+ | PHP Version 4 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2003 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 2.02 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available at through the world-wide-web at | | [www.php.net]. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Christian Dickmann <dickmann@php.net> | | Pierre-Alain Joye <pajoye@php.net> | | Tias Guns <tias@ulyssis.org> | +----------------------------------------------------------------------+ * Web-based PEAR Frontend, include this file to display the fontend. * This file does the basic configuration, handles all requests and calls * the needed commands. * * @category pear * @package PEAR_Frontend_Web * @author Christian Dickmann <dickmann@php.net> * @author Pierre-Alain Joye <pajoye@php.net> * @author Tias Guns <tias@ulyssis.org> * @copyright 1997-2007 The PHP Group * @license [www.php.net] PHP License 2.02 * @version CVS: $Id: pearfrontendweb.php,v 1.69 2008/08/02 16:22:35 tias Exp $ * @link [pear.php.net] * @since File available since Release 0.1 */ /** * This is PEAR_Frontend_Web */ define('PEAR_Frontend_Web',1); @session_start(); /** * base frontend class */ require_once 'PEAR/Frontend.php'; require_once 'PEAR/Command.php'; // for the open_basedir prisoners, don't allow PEAR to search for a temp dir (would use /tmp), see bug #13167 putenv('TMPDIR='.dirname(__FILE__).'/temp'); // set $pear_user_config if it isn't set yet // finds an existing file, or proposes the default location if (!isset($pear_user_config) || $pear_user_config == '') { if (OS_WINDOWS) { $conf_name = 'pear.ini'; } else { $conf_name = 'pear.conf'; } // default backup config: the one from the installer (if available). $install_config = '@pear_install_config@'; // filled in on install // TODO: doesn't work yet ! There is no way to find the system config if (file_exists($install_config)) { $pear_user_config = $install_config; } else { // find other config file location $default_config_dirs = array( substr(dirname(__FILE__), 0, strrpos(dirname(__FILE__), DIRECTORY_SEPARATOR)), // strip eg PEAR from .../example/PEAR(/pearfrontendweb.php) dirname($_SERVER['SCRIPT_FILENAME']), PEAR_CONFIG_SYSCONFDIR, ); // set the default: __FILE__ without PEAR/ $pear_user_config = $default_config_dirs[0].DIRECTORY_SEPARATOR.$conf_name; $found = false; foreach ($default_config_dirs as $confdir) { if (file_exists($confdir.DIRECTORY_SEPARATOR.$conf_name)) { $pear_user_config = $confdir.DIRECTORY_SEPARATOR.$conf_name; $found = true; break; } } if (!$found) { print('<p><b>Warning:</b> Can not find config file, please specify the $pear_user_config variable in '.$_SERVER['PHP_SELF'].'</p>'); } } unset($conf_name, $default_config_dirs, $confdir); } require_once 'PEAR/Registry.php'; require_once 'PEAR/Config.php'; // moving this here allows startup messages and errors to work properly PEAR_Frontend::setFrontendClass('PEAR_Frontend_Web'); // Init PEAR Installer Code and WebFrontend $GLOBALS['_PEAR_Frontend_Web_config'] = &PEAR_Config::singleton($pear_user_config, ''); $config = &$GLOBALS['_PEAR_Frontend_Web_config']; if (PEAR::isError($config)) { die('<b>Error:</b> '.$config->getMessage()); } $ui = &PEAR_Command::getFrontendObject(); if (PEAR::isError($ui)) { die('<b>Error:</b> '.$ui->getMessage()); } $ui->setConfig($config); PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"); // Cient requests an Image/Stylesheet/Javascript // outputFrontendFile() does exit() if (isset($_GET["css"])) { $ui->outputFrontendFile($_GET["css"], 'css'); } if (isset($_GET["js"])) { $ui->outputFrontendFile($_GET["js"], 'js'); } if (isset($_GET["img"])) { $ui->outputFrontendFile($_GET["img"], 'image'); } $verbose = $config->get("verbose" $cmdopts = array(); $opts = array(); $params = array(); // create $pear_user_config if it doesn't exit yet if (!file_exists($pear_user_config)) { // I think PEAR_Frontend_Web is running for the first time! // Create config and install it properly ... $ui->outputBegin(null); print('<h3>Preparing PEAR_Frontend_Web for its first time use...</h3>'); // find pear_dir: if (!isset($pear_dir) || !file_exists($pear_dir)) { // __FILE__ is eg .../example/PEAR/pearfrontendweb.php $pear_dir = dirname(__FILE__); // eg .../example/PEAR } if (substr($pear_dir, -1) == DIRECTORY_SEPARATOR) { $pear_dir = substr($pear_dir, 0, -1); // strip trailing / } // extract base_dir from pear_dir $dir = substr($pear_dir, 0, strrpos($pear_dir, DIRECTORY_SEPARATOR)); // eg .../example $dir .= DIRECTORY_SEPARATOR; if (!is_dir($dir)) { PEAR::raiseError('Can not find a base installation directory of PEAR ('.$dir.' doesn\'t work), so we can\'t create a config for it. Please supply it in the variable \'$pear_dir\'. The $pear_dir must have at least the subdirectory PEAR/ and be writable by this frontend.'); die(); } print('Saving config file ('.$pear_user_config.')...'); // First of all set some config-vars: // Tries to be compatible with go-pear if (!isset($pear_dir)) { $pear_dir = $dir.'PEAR'; // default (go-pear compatible) } $cmd = PEAR_Command::factory('config-set', $config); $ok = $cmd->run('config-set', array(), array('php_dir', $pear_dir)); $ok = $cmd->run('config-set', array(), array('doc_dir', $pear_dir.'/docs')); $ok = $cmd->run('config-set', array(), array('ext_dir', $dir.'ext')); $ok = $cmd->run('config-set', array(), array('bin_dir', $dir.'bin')); $ok = $cmd->run('config-set', array(), array('data_dir', $pear_dir.'/data')); $ok = $cmd->run('config-set', array(), array('test_dir', $pear_dir.'/test')); $ok = $cmd->run('config-set', array(), array('temp_dir', $dir.'temp')); $ok = $cmd->run('config-set', array(), array('download_dir', $dir.'temp/download')); $ok = $cmd->run('config-set', array(), array('cache_dir', $pear_dir.'/cache')); $ok = $cmd->run('config-set', array(), array('cache_ttl', 300)); $ok = $cmd->run('config-set', array(), array('default_channel', 'pear.php.net')); $ok = $cmd->run('config-set', array(), array('preferred_mirror', 'pear.php.net')); print('Checking package registry...'); // Register packages $packages = array( 'Archive_Tar', 'Console_Getopt', 'HTML_Template_IT', 'PEAR', 'PEAR_Frontend_Web', 'Structures_Graph' ); $reg = &$config->getRegistry(); if (!file_exists($pear_dir.'/.registry')) { PEAR::raiseError('Directory "'.$pear_dir.'/.registry" does not exist. please check your installation'); } foreach($packages as $pkg) { $info = $reg->packageInfo($pkg); foreach($info['filelist'] as $fileName => $fileInfo) { if($fileInfo['role'] == "php" { $info['filelist'][$fileName]['installed_as'] = str_replace('{dir}',$dir, $fileInfo['installed_as']); } } $reg->updatePackage($pkg, $info, false); } print('<p><em>PEAR_Frontend_Web configured succesfully !</em></p>'); $msg = sprintf('<p><a href="%s">Click here to continue</a></p>', $_SERVER['PHP_SELF']); print($msg); $ui->outputEnd(null); die(); } // Check _isProtected() override (disables the 'not protected' warning) if (isset($pear_frontweb_protected) && $pear_frontweb_protected === true) { $GLOBALS['_PEAR_Frontend_Web_protected'] = true; } $cache_dir = $config->get('cache_dir'); if (!is_dir($cache_dir)) { include_once 'System.php'; if (!System::mkDir('-p', $cache_dir)) { PEAR::raiseError('Directory "'.$cache_dir.'" does not exist and cannot be created. Please check your installation'); } } if (isset($_GET['command']) && !is_null($_GET['command'])) { $command = $_GET['command']; } else { $command = 'list'; } // Prepare and begin output $ui->outputBegin($command); // Handle some different Commands switch ($command) { case 'install': case 'uninstall': case 'upgrade': if ($_GET['command'] == 'install') { // also install dependencies $opts['onlyreqdeps'] = true; if (isset($_GET['force']) && $_GET['force'] == 'on') { $opts['force'] = true; } } if (strpos($_GET['pkg'], '\\\\') !== false) { $_GET['pkg'] = stripslashes($_GET['pkg']); } $params = array($_GET["pkg"]); $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); $reg = &$config->getRegistry(); PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); $err = $reg->parsePackageName($_GET['pkg']); PEAR::staticPopErrorHandling(); // reset error handling if (!PEAR::isError($err)) { $ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command=info&pkg='.$_GET['pkg'], 'text' => 'View package information')); } break; case 'run-scripts' : $params = array($_GET['pkg']); $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); break; case 'info': case 'remote-info': $reg = &$config->getRegistry(); // we decide what it is: $pkg = $reg->parsePackageName($_GET['pkg']); if ($reg->packageExists($pkg['package'], $pkg['channel'])) { $command = 'info'; } else { $command = 'remote-info'; } $params = array(strtolower($_GET['pkg'])); $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); break; case 'search': if (!isset($_POST['search']) || $_POST['search'] == '') { // unsubmited, show forms $ui->outputSearch(); } else { if ($_POST['channel'] == 'all') { $opts['allchannels'] = true; } else { $opts['channel'] = $_POST['channel']; } $opts['channelinfo'] = true; // submited, do search switch ($_POST['search']) { case 'name': $params = array($_POST['input']); break; case 'description': $params = array($_POST['input'], $_POST['input']); break; default: PEAR::raiseError('Can\'t search for '.$_POST['search']); break; } $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); } break; case 'config-show': $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); // if this code is reached, the config vars are submitted $set = PEAR_Command::factory('config-set', $config); foreach($GLOBALS['_PEAR_Frontend_Web_Config'] as $var => $value) { if ($var == 'Filename') { continue; // I hate obscure bugs } if ($value != $config->get($var)) { print('Saving '.$var.'... '); $res = $set->run('config-set', $opts, array($var, $value)); $config->set($var, $value); } } print('<p><b>Config saved succesfully!</b></p>'); $ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command='.$command, 'text' => 'Back to the config')); break; case 'list-files': $params = array($_GET['pkg']); $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); break; case 'list-docs': if (!isset($_GET['pkg'])) { PEAR::raiseError('The webfrontend-command list-docs needs at least one \'pkg\' argument.'); break; } require_once('PEAR/Frontend/Web/Docviewer.php'); $reg = $config->getRegistry(); $pkg = $reg->parsePackageName($_GET['pkg']); $docview = new PEAR_Frontend_Web_Docviewer($ui); $docview->outputListDocs($pkg['package'], $pkg['channel']); break; case 'doc-show': if (!isset($_GET['pkg']) || !isset($_GET['file'])) { PEAR::raiseError('The webfrontend-command list-docs needs one \'pkg\' and one \'file\' argument.'); break; } require_once('PEAR/Frontend/Web/Docviewer.php'); $reg = $config->getRegistry(); $pkg = $reg->parsePackageName($_GET['pkg']); $docview = new PEAR_Frontend_Web_Docviewer($ui); $docview->outputDocShow($pkg['package'], $pkg['channel'], $_GET['file']); break; case 'list-all': // Deprecated, use 'list-categories' is used instead if (isset($_GET['chan']) && $_GET['chan'] != '') { $opts['channel'] = $_GET['chan']; } $opts['channelinfo'] = true; $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); break; case 'list-categories': case 'list-packages': if (isset($_GET['chan']) && $_GET['chan'] != '') { $opts['channel'] = $_GET['chan']; } else { // show 'table of contents' before all channel output $ui->outputTableOfChannels(); $opts['allchannels'] = true; } if (isset($_GET['opt']) && $_GET['opt'] == 'packages') { $opts['packages'] = true; } $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); break; case 'list-category': if (isset($_GET['chan']) && $_GET['chan'] != '') { $opts['channel'] = $_GET['chan']; } $params = array($_GET['cat']); $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); break; case 'list': $opts['allchannels'] = true; $opts['channelinfo'] = true; $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); break; case 'list-upgrades': $opts['channelinfo'] = true; $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); $ui->outputUpgradeAll(); break; case 'upgrade-all': $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); $ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command=list', 'text' => 'Click here to go back')); break; case 'channel-info': if (isset($_GET['chan'])) $params[] = $_GET['chan']; $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); break; case 'channel-discover': if (isset($_GET['chan']) && $_GET['chan'] != '') $params[] = $_GET['chan']; $cmd = PEAR_Command::factory($command, $config); $ui->startSession(); $ok = $cmd->run($command, $opts, $params); $ui->finishOutput('Channel Discovery', array('link' => $_SERVER['PHP_SELF'] . '?command=channel-info&chan=' . urlencode($_GET['chan']), 'text' => 'Click Here for ' . htmlspecialchars($_GET['chan']) . ' Information')); break; case 'channel-delete': if (isset($_GET["chan"])) $params[] = $_GET["chan"]; $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); $ui->finishOutput('Delete Channel', array('link' => $_SERVER['PHP_SELF'] . '?command=list-channels', 'text' => 'Click here to list all channels')); break; case 'list-channels': $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); break; case 'channel-update': if (isset($_GET['chan'])) { $params = array($_GET['chan']); } $cmd = PEAR_Command::factory($command, $config); $ok = $cmd->run($command, $opts, $params); break; case 'update-channels': // update every channel manually, // fixes bug PEAR/#10275 (XML_RPC dependency) // will be fixed in next pear release $reg = &$config->getRegistry(); $channels = $reg->getChannels(); $command = 'channel-update'; $cmd = PEAR_Command::factory($command, $config); $success = true; $ui->startSession(); foreach ($channels as $channel) { if ($channel->getName() != '__uri') { $success &= $cmd->run($command, $opts, array($channel->getName())); } } $ui->finishOutput('Update Channel List', array('link' => $_SERVER['PHP_SELF'] . '?command=list-channels', 'text' => 'Click here to list all channels')); break; default: $cmd = PEAR_Command::factory($command, $config); $res = $cmd->run($command, $opts, $params); break; } $ui->outputEnd($command); ?>J'ai la bonne adresse pour mon dossier PEAR dans le répertoire "www" de wampServeur :
<?php /** * Put this file in a web-accessible directory as index.php (or similar) * and point your webbrowser to it. */ // $pear_dir must point to a valid PEAR install (=contains PEAR.php) $pear_dir = 'C:\wamp\www/PEAR'; // default of install // OPTIONAL: If you have a config file at a non-standard location, // uncomment and supply it here: //$pear_user_config = ''; // OPTIONAL: If you have protected this webfrontend with a password in a // custom way, then uncomment to disable the 'not protected' warning: //$pear_frontweb_protected = true; /*********************************************************** * Following code tests $pear_dir and loads the webfrontend: */ if (!file_exists($pear_dir.'/PEAR.php')) { trigger_error('No PEAR.php in supplied PEAR directory: '.$pear_dir, E_USER_ERROR); } ini_set('include_path', $pear_dir); require_once('PEAR.php'); // Include WebInstaller putenv('PHP_PEAR_INSTALL_DIR='.$pear_dir); // needed if unexisting config require_once('pearfrontendweb.php'); ?>Je n'arrive pas à pouvoir corriger ces erreurs
J'ai indiqué dans ma page "index.php" de "localhost" le chemin du fichier Config.php qui est dans le dossier "PEAR" comme ceux-ci "$pear_user_config = 'C:\wamp\www/PEAR';" ce qui donne maintenant la page index.php :Citation
Notice: Use of undefined constant PEAR_CONFIG_SYSCONFDIR - assumed 'PEAR_CONFIG_SYSCONFDIR' in C:\wamp\www\PEAR\pearfrontendweb.php on line 72
Warning: Can not find config file, please specify the $pear_user_config variable in /index.php
Error: the template directory (C:\php5\pear\data\PEAR_Frontend_Web\data\templates) is not a directory, or not readable. Make sure the 'data_dir' of your config file (C:\php5\pear\data) points to the correct location !
<?php /** * Put this file in a web-accessible directory as index.php (or similar) * and point your webbrowser to it. */ // $pear_dir must point to a valid PEAR install (=contains PEAR.php) $pear_dir = 'C:\wamp\www/PEAR'; // default of install // OPTIONAL: If you have a config file at a non-standard location, // uncomment and supply it here: $pear_user_config = 'C:\wamp\www/PEAR'; // OPTIONAL: If you have protected this webfrontend with a password in a // custom way, then uncomment to disable the 'not protected' warning: //$pear_frontweb_protected = true; /*********************************************************** * Following code tests $pear_dir and loads the webfrontend: */ if (!file_exists($pear_dir.'/PEAR.php')) { trigger_error('No PEAR.php in supplied PEAR directory: '.$pear_dir, E_USER_ERROR); } ini_set('include_path', $pear_dir); require_once('PEAR.php'); // Include WebInstaller putenv('PHP_PEAR_INSTALL_DIR='.$pear_dir); // needed if unexisting config require_once('pearfrontendweb.php'); ?>Ce qui me provoque l'erreur suivante quand j'exécute cette page :
Voici ma page config.php du dossier PEAR :Citation
Error: PEAR_Config::readConfigFile fopen('C:\wamp\www/PEAR','r') failed
<?php // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2003 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | [www.php.net]. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // // $Id: Config.php,v 1.22 2006/12/22 00:35:34 aashley Exp $ require_once('PEAR.php'); require_once('Config/Container.php'); $GLOBALS['CONFIG_TYPES'] = array( 'apache' => array('Config/Container/Apache.php', 'Config_Container_Apache'), 'genericconf' => array('Config/Container/GenericConf.php', 'Config_Container_GenericConf'), 'inifile' => array('Config/Container/IniFile.php', 'Config_Container_IniFile'), 'inicommented' => array('Config/Container/IniCommented.php', 'Config_Container_IniCommented'), 'phparray' => array('Config/Container/PHPArray.php', 'Config_Container_PHPArray'), 'phpconstants' => array('Config/Container/PHPConstants.php', 'Config_Container_PHPConstants'), 'xml' => array('Config/Container/XML.php', 'Config_Container_XML') ); /** * Config * * This class allows for parsing and editing of configuration datasources. * Do not use this class only to read datasources because of the overhead * it creates to keep track of the configuration structure. * * @author Bertrand Mansion <bmansion@mamasam.com> * @package Config */ class Config { /** * Datasource * Can be a file url, a dsn, an object... * @var mixed */ var $datasrc; /** * Type of datasource for config * Ex: IniCommented, Apache... * @var string */ var $configType = ''; /** * Options for parser * @var string */ var $parserOptions = array(); /** * Container object * @var object */ var $container; /** * Constructor * Creates a root container * * @access public */ function Config() { $this->container =& new Config_Container('section', 'root'); } // end constructor /** * Returns true if container is registered * * @param string $configType Type of config * @access public * @return bool */ function isConfigTypeRegistered($configType) { return isset($GLOBALS['CONFIG_TYPES'][strtolower($configType)]); } // end func isConfigTypeRegistered /** * Register a new container * * @param string $configType Type of config * @param array|false $configInfo Array of format: * array('path/to/Name.php', * 'Config_Container_Class_Name'). * * If left false, defaults to: * array('Config/Container/$configType.php', * 'Config_Container_$configType') * @access public * @static * @author Greg Beaver <cellog@users.sourceforge.net> * @return true|PEAR_Error true on success */ function registerConfigType($configType, $configInfo = false) { if (Config::isConfigTypeRegistered($configType)) { $info = $GLOBALS['CONFIG_TYPES'][strtolower($configType)]; if ($info[0] == $configInfo[0] && $info[1] == $configInfo[1]) { return true; } else { return PEAR::raiseError("Config::registerConfigType registration of existing $configType failed.", null, PEAR_ERROR_RETURN); } } if (!is_array($configInfo)) { // make the normal assumption, that this is a standard config container added in at runtime $configInfo = array('Config/Container/' . $configType . '.php', 'Config_Container_'. $configType); } $file_exists = @include_once($configInfo[0]); if ($file_exists) { if (!class_exists($configInfo[1])) { return PEAR::raiseError("Config::registerConfigType class '$configInfo[1]' not found in $configInfo[0]", null, PEAR_ERROR_RETURN); } } else { return PEAR::raiseError("Config::registerConfigType file $configInfo[0] not found", null, PEAR_ERROR_RETURN); } $GLOBALS['CONFIG_TYPES'][strtolower($configType)] = $configInfo; return true; } // end func registerConfigType /** * Returns the root container for this config object * * @access public * @return object reference to config's root container object */ function &getRoot() { return $this->container; } // end func getRoot /** * Sets the content of the root Config_container object. * * This method will replace the current child of the root * Config_Container object by the given object. * * @param object $rootContainer container to be used as the first child to root * @access public * @return mixed true on success or PEAR_Error */ function setRoot(&$rootContainer) { if (is_object($rootContainer) && strtolower(get_class($rootContainer)) === 'config_container') { if ($rootContainer->getName() === 'root' && $rootContainer->getType() === 'section') { $this->container =& $rootContainer; } else { $this->container =& new Config_Container('section', 'root'); $this->container->addItem($rootContainer); } return true; } else { return PEAR::raiseError("Config::setRoot only accepts object of Config_Container type.", null, PEAR_ERROR_RETURN); } } // end func setRoot /** * Parses the datasource contents * * This method will parse the datasource given and fill the root * Config_Container object with other Config_Container objects. * * @param mixed $datasrc Datasource to parse * @param string $configType Type of configuration * @param array $options Options for the parser * @access public * @return mixed PEAR_Error on error or Config_Container object */ function &parseConfig($datasrc, $configType, $options = array()) { $configType = strtolower($configType); if (!$this->isConfigTypeRegistered($configType)) { return PEAR::raiseError("Configuration type '$configType' is not registered in Config::parseConfig.", null, PEAR_ERROR_RETURN); } $includeFile = $GLOBALS['CONFIG_TYPES'][$configType][0]; $className = $GLOBALS['CONFIG_TYPES'][$configType][1]; include_once($includeFile); $parser = new $className($options); $error = $parser->parseDatasrc($datasrc, $this); if ($error !== true) { return $error; } $this->parserOptions = $parser->options; $this->datasrc = $datasrc; $this->configType = $configType; return $this->container; } // end func &parseConfig /** * Writes the container contents to the datasource. * * @param mixed $datasrc Datasource to write to * @param string $configType Type of configuration * @param array $options Options for config container * @access public * @return mixed PEAR_Error on error or true if ok */ function writeConfig($datasrc = null, $configType = null, $options = array()) { if (empty($datasrc)) { $datasrc = $this->datasrc; } if (empty($configType)) { $configType = $this->configType; } if (empty($options)) { $options = $this->parserOptions; } return $this->container->writeDatasrc($datasrc, $configType, $options); } // end func writeConfig } // end class Config ?>Là moi je ne vois pas comment corriger cette erreur !