mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:15 +01:00
also list channels to not attempt to install already installed channel packages
This commit is contained in:
parent
30ae4474dd
commit
90d2c68139
@ -527,14 +527,22 @@ function usage($error=null)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if required PEAR packges are installed and install them if not, update pear packages with to low version
|
||||
* Get installed pear packages, optional from a certain channel
|
||||
*
|
||||
* @global type $config
|
||||
* @param string $channel=''
|
||||
* @return null|array with package => version
|
||||
*/
|
||||
function check_install_pear_packages()
|
||||
function pear_list($channel='')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$out = $ret = null;
|
||||
exec($config['pear'].' list',$out,$ret);
|
||||
exec($config['pear'].' list'.($channel?' -c '.$channel:''),$out,$ret);
|
||||
if ($channel && $ret == 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if ($ret)
|
||||
{
|
||||
echo "Error running pear command ($config[pear])!\n";
|
||||
@ -546,11 +554,23 @@ function check_install_pear_packages()
|
||||
$matches = null;
|
||||
if (preg_match('/^([a-z0-9_]+)\s+([0-9.]+[a-z0-9]*)\s+([a-z]+)/i',$line,$matches))
|
||||
{
|
||||
$packages_installed[$matches[1]] = $matches[2];
|
||||
$packages_installed[($channel?$channel.'/':'').$matches[1]] = $matches[2];
|
||||
}
|
||||
}
|
||||
return $packages_installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if required PEAR packges are installed and install them if not, update pear packages with to low version
|
||||
*/
|
||||
function check_install_pear_packages()
|
||||
{
|
||||
global $config;
|
||||
$packages_installed = pear_list();
|
||||
|
||||
// read required packages from apps
|
||||
$packages = array('PEAR' => true, 'HTTP_WebDAV_Server' => '999.egw-pear'); // pear must be the first, to run it's update first!
|
||||
$channels = array();
|
||||
$egw_pear_packages = array();
|
||||
$setup_info = array();
|
||||
foreach(scandir($config['source_dir']) as $app)
|
||||
@ -566,6 +586,24 @@ function check_install_pear_packages()
|
||||
if ($args['func'] == 'pear_check')
|
||||
{
|
||||
if (!$package) $package = 'PEAR';
|
||||
// if package is prefixed with a channel, list or discover it first
|
||||
if (strpos($package, '/'))
|
||||
{
|
||||
list($channel) = explode('/', $package);
|
||||
if (!in_array($channel, $channels))
|
||||
{
|
||||
if (($channel_packages = pear_list($channel)))
|
||||
{
|
||||
$packages_installed += $channel_packages;
|
||||
}
|
||||
else
|
||||
{
|
||||
$discover_cmd = $config['pear'].' channel-discover '.$channel;
|
||||
echo "$discover_cmd\n"; system($discover_cmd);
|
||||
}
|
||||
$channels[] = $channel;
|
||||
}
|
||||
}
|
||||
// only overwrite lower version or no version
|
||||
if (!isset($packages[$package]) || $packages[$package] === true || isset($args['version']) && version_compare($args['version'],$packages[$package],'>'))
|
||||
{
|
||||
@ -619,23 +657,7 @@ function check_install_pear_packages()
|
||||
}
|
||||
if ($to_install)
|
||||
{
|
||||
$channels = array();
|
||||
$cmd = $config['pear'].' install';
|
||||
foreach($to_install as $package)
|
||||
{
|
||||
// if package is prefixed with a channel, discover it before installing package
|
||||
if (strpos($package, '/') !== false)
|
||||
{
|
||||
list($channel) = explode('/', $package);
|
||||
if (!in_array($channel, $channels))
|
||||
{
|
||||
$discover_cmd = $config['pear'].' channel-discover '.$channel;
|
||||
echo "$discover_cmd\n"; system($discover_cmd);
|
||||
$channels[] = $channel;
|
||||
}
|
||||
}
|
||||
$cmd .= ' '.$package;
|
||||
}
|
||||
$cmd = $config['pear'].' install '.implode(' ', $to_install);
|
||||
echo "$cmd\n"; system($cmd);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user