Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 94 → Rev 187

/trunk/bibliotheque/pear/PEAR/Installer/Role/Data.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Data.php,v 1.6 2006/01/06 04:47:37 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
24,9 → 17,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
/trunk/bibliotheque/pear/PEAR/Installer/Role/Man.php
New file
0,0 → 1,28
<?php
/**
* PEAR_Installer_Role_Man
*
* PHP versions 4 and 5
*
* @category pear
* @package PEAR
* @author Hannes Magnusson <bjori@php.net>
* @copyright 2011 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version SVN: $Id: $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.10.0
*/
 
/**
* @category pear
* @package PEAR
* @author Hannes Magnusson <bjori@php.net>
* @copyright 2011 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.10.0
*/
class PEAR_Installer_Role_Man extends PEAR_Installer_Role_Common {}
?>
/trunk/bibliotheque/pear/PEAR/Installer/Role/Test.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Test.php,v 1.6 2006/01/06 04:47:37 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
24,9 → 17,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
/trunk/bibliotheque/pear/PEAR/Installer/Role/Www.php
New file
0,0 → 1,27
<?php
/**
* PEAR_Installer_Role_Www
*
* PHP versions 4 and 5
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 2007-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.7.0
*/
 
/**
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 2007-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.7.0
*/
class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {}
?>
/trunk/bibliotheque/pear/PEAR/Installer/Role/Man.xml
New file
0,0 → 1,15
<role version="1.0">
<releasetypes>php</releasetypes>
<releasetypes>extsrc</releasetypes>
<releasetypes>extbin</releasetypes>
<releasetypes>zendextsrc</releasetypes>
<releasetypes>zendextbin</releasetypes>
<installable>1</installable>
<locationconfig>man_dir</locationconfig>
<honorsbaseinstall>1</honorsbaseinstall>
<unusualbaseinstall />
<phpfile />
<executable />
<phpextension />
<config_vars />
</role>
/trunk/bibliotheque/pear/PEAR/Installer/Role/Php.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Php.php,v 1.7 2006/01/06 04:47:37 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
24,9 → 17,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
/trunk/bibliotheque/pear/PEAR/Installer/Role/Src.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Src.php,v 1.6 2006/01/06 04:47:37 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
24,9 → 17,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
/trunk/bibliotheque/pear/PEAR/Installer/Role/Common.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Common.php,v 1.12 2006/10/19 23:55:32 cellog Exp $
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
29,8 → 22,8
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
45,7 → 38,7
/**
* @param PEAR_Config
*/
function PEAR_Installer_Role_Common(&$config)
function __construct(&$config)
{
$this->config = $config;
}
177,4 → 170,4
return $roleInfo['phpextension'];
}
}
?>
?>
/trunk/bibliotheque/pear/PEAR/Installer/Role/Www.xml
New file
0,0 → 1,15
<role version="1.0">
<releasetypes>php</releasetypes>
<releasetypes>extsrc</releasetypes>
<releasetypes>extbin</releasetypes>
<releasetypes>zendextsrc</releasetypes>
<releasetypes>zendextbin</releasetypes>
<installable>1</installable>
<locationconfig>www_dir</locationconfig>
<honorsbaseinstall>1</honorsbaseinstall>
<unusualbaseinstall />
<phpfile />
<executable />
<phpextension />
<config_vars />
</role>
/trunk/bibliotheque/pear/PEAR/Installer/Role/Cfg.php
New file
0,0 → 1,105
<?php
/**
* PEAR_Installer_Role_Cfg
*
* PHP versions 4 and 5
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 2007-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.7.0
*/
 
/**
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 2007-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.7.0
*/
class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common
{
/**
* @var PEAR_Installer
*/
var $installer;
 
/**
* the md5 of the original file
*
* @var unknown_type
*/
var $md5 = null;
 
/**
* Do any unusual setup here
* @param PEAR_Installer
* @param PEAR_PackageFile_v2
* @param array file attributes
* @param string file name
*/
function setup(&$installer, $pkg, $atts, $file)
{
$this->installer = &$installer;
$reg = &$this->installer->config->getRegistry();
$package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel());
if ($package) {
$filelist = $package->getFilelist();
if (isset($filelist[$file]) && isset($filelist[$file]['md5sum'])) {
$this->md5 = $filelist[$file]['md5sum'];
}
}
}
 
function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
{
$test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer);
if (@file_exists($test[2]) && @file_exists($test[3])) {
$md5 = md5_file($test[2]);
// configuration has already been installed, check for mods
if ($md5 !== $this->md5 && $md5 !== md5_file($test[3])) {
// configuration has been modified, so save our version as
// configfile-version
$old = $test[2];
$test[2] .= '.new-' . $pkg->getVersion();
// backup original and re-install it
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$tmpcfg = $this->config->get('temp_dir');
$newloc = System::mkdir(array('-p', $tmpcfg));
if (!$newloc) {
// try temp_dir
$newloc = System::mktemp(array('-d'));
if (!$newloc || PEAR::isError($newloc)) {
PEAR::popErrorHandling();
return PEAR::raiseError('Could not save existing configuration file '.
$old . ', unable to install. Please set temp_dir ' .
'configuration variable to a writeable location and try again');
}
} else {
$newloc = $tmpcfg;
}
 
$temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile');
if (!@copy($old, $temp_file)) {
PEAR::popErrorHandling();
return PEAR::raiseError('Could not save existing configuration file '.
$old . ', unable to install. Please set temp_dir ' .
'configuration variable to a writeable location and try again');
}
 
PEAR::popErrorHandling();
$this->installer->log(0, "WARNING: configuration file $old is being installed as $test[2], you should manually merge in changes to the existing configuration file");
$this->installer->addFileOperation('rename', array($temp_file, $old, false));
$this->installer->addFileOperation('delete', array($temp_file));
}
}
 
return $test;
}
}
/trunk/bibliotheque/pear/PEAR/Installer/Role/Ext.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Ext.php,v 1.6 2006/01/06 04:47:37 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
24,9 → 17,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
/trunk/bibliotheque/pear/PEAR/Installer/Role/Src.xml
1,8 → 1,8
<role version="1.0">
<releasetypes>extsrc</releasetypes>
<releasetypes>zendextsrc</releasetypes>
<installable />
<locationconfig />
<installable>1</installable>
<locationconfig>temp_dir</locationconfig>
<honorsbaseinstall />
<unusualbaseinstall />
<phpfile />
/trunk/bibliotheque/pear/PEAR/Installer/Role/Script.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Script.php,v 1.6 2006/01/06 04:47:37 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
24,9 → 17,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
/trunk/bibliotheque/pear/PEAR/Installer/Role/Doc.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Doc.php,v 1.6 2006/01/06 04:47:37 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
24,9 → 17,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
/trunk/bibliotheque/pear/PEAR/Installer/Role/Cfg.xml
New file
0,0 → 1,15
<role version="1.0">
<releasetypes>php</releasetypes>
<releasetypes>extsrc</releasetypes>
<releasetypes>extbin</releasetypes>
<releasetypes>zendextsrc</releasetypes>
<releasetypes>zendextbin</releasetypes>
<installable>1</installable>
<locationconfig>cfg_dir</locationconfig>
<honorsbaseinstall />
<unusualbaseinstall>1</unusualbaseinstall>
<phpfile />
<executable />
<phpextension />
<config_vars />
</role>
/trunk/bibliotheque/pear/PEAR/Installer/Role.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Role.php,v 1.16 2006/10/31 02:54:41 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
29,9 → 22,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
42,19 → 35,19
*
* Never call this directly, it is called by the PEAR_Config constructor
* @param PEAR_Config
* @access private
* @static
*/
function initializeConfig(&$config)
public static function initializeConfig(&$config)
{
if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
PEAR_Installer_Role::registerRoles();
}
 
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $class => $info) {
if (!$info['config_vars']) {
continue;
}
$config->_addConfigVars($info['config_vars']);
 
$config->_addConfigVars($class, $info['config_vars']);
}
}
 
63,21 → 56,23
* @param string role name
* @param PEAR_Config
* @return PEAR_Installer_Role_Common
* @static
*/
function &factory($pkg, $role, &$config)
public static function &factory($pkg, $role, &$config)
{
if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
PEAR_Installer_Role::registerRoles();
}
 
if (!in_array($role, PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) {
$a = false;
return $a;
}
 
$a = 'PEAR_Installer_Role_' . ucfirst($role);
if (!class_exists($a)) {
require_once str_replace('_', '/', $a) . '.php';
}
 
$b = new $a($config);
return $b;
}
89,20 → 84,22
* @param string
* @param bool clear cache
* @return array
* @static
*/
function getValidRoles($release, $clear = false)
public static function getValidRoles($release, $clear = false)
{
if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
PEAR_Installer_Role::registerRoles();
}
 
static $ret = array();
if ($clear) {
$ret = array();
}
 
if (isset($ret[$release])) {
return $ret[$release];
}
 
$ret[$release] = array();
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
if (in_array($release, $okreleases['releasetypes'])) {
109,6 → 106,7
$ret[$release][] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
}
}
 
return $ret[$release];
}
 
120,25 → 118,29
* roles are actually fully bundled releases of a package
* @param bool clear cache
* @return array
* @static
*/
function getInstallableRoles($clear = false)
public static function getInstallableRoles($clear = false)
{
if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
PEAR_Installer_Role::registerRoles();
}
 
static $ret;
if ($clear) {
unset($ret);
}
if (!isset($ret)) {
$ret = array();
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
if ($okreleases['installable']) {
$ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
}
 
if (isset($ret)) {
return $ret;
}
 
$ret = array();
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
if ($okreleases['installable']) {
$ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
}
}
 
return $ret;
}
 
150,25 → 152,29
* so a tests file tests/file.phpt is installed into PackageName/tests/filepath.php
* @param bool clear cache
* @return array
* @static
*/
function getBaseinstallRoles($clear = false)
public static function getBaseinstallRoles($clear = false)
{
if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
PEAR_Installer_Role::registerRoles();
}
 
static $ret;
if ($clear) {
unset($ret);
}
if (!isset($ret)) {
$ret = array();
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
if ($okreleases['honorsbaseinstall']) {
$ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
}
 
if (isset($ret)) {
return $ret;
}
 
$ret = array();
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
if ($okreleases['honorsbaseinstall']) {
$ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
}
}
 
return $ret;
}
 
177,25 → 183,29
* like the "php" role.
* @param bool clear cache
* @return array
* @static
*/
function getPhpRoles($clear = false)
public static function getPhpRoles($clear = false)
{
if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
PEAR_Installer_Role::registerRoles();
}
 
static $ret;
if ($clear) {
unset($ret);
}
if (!isset($ret)) {
$ret = array();
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
if ($okreleases['phpfile']) {
$ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
}
 
if (isset($ret)) {
return $ret;
}
 
$ret = array();
foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
if ($okreleases['phpfile']) {
$ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
}
}
 
return $ret;
}
 
208,10 → 218,8
* included.
*
* @return bool TRUE on success, a PEAR error on failure
* @access public
* @static
*/
function registerRoles($dir = null)
public static function registerRoles($dir = null)
{
$GLOBALS['_PEAR_INSTALLER_ROLES'] = array();
$parser = new PEAR_XMLParser;
218,17 → 226,21
if ($dir === null) {
$dir = dirname(__FILE__) . '/Role';
}
 
if (!file_exists($dir) || !is_dir($dir)) {
return PEAR::raiseError("registerRoles: opendir($dir) failed");
return PEAR::raiseError("registerRoles: opendir($dir) failed: does not exist/is not directory");
}
 
$dp = @opendir($dir);
if (empty($dp)) {
return PEAR::raiseError("registerRoles: opendir($dir) failed");
return PEAR::raiseError("registerRoles: opendir($dir) failed: $php_errmsg");
}
 
while ($entry = readdir($dp)) {
if ($entry{0} == '.' || substr($entry, -4) != '.xml') {
continue;
}
 
$class = "PEAR_Installer_Role_".substr($entry, 0, -4);
// List of roles
if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'][$class])) {
238,9 → 250,11
if (!is_array($data['releasetypes'])) {
$data['releasetypes'] = array($data['releasetypes']);
}
 
$GLOBALS['_PEAR_INSTALLER_ROLES'][$class] = $data;
}
}
 
closedir($dp);
ksort($GLOBALS['_PEAR_INSTALLER_ROLES']);
PEAR_Installer_Role::getBaseinstallRoles(true);
249,5 → 263,4
PEAR_Installer_Role::getValidRoles('****', true);
return true;
}
}
?>
}