1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/11150] Do not override extensions installed manually

PHPBB3-11150
This commit is contained in:
Tristan Darricau
2015-09-09 23:35:14 +02:00
committed by Tristan Darricau
parent fbb85e2f4f
commit ac129f34d3
9 changed files with 180 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ use phpbb\composer\exception\runtime_exception;
/**
* Class to manage packages through composer.
*/
class manager
class manager implements manager_interface
{
/**
* @var installer Composer packages installer
@@ -74,6 +74,16 @@ class manager
throw new runtime_exception($this->exception_prefix, 'ALREADY_INSTALLED', [implode('|', $already_managed)]);
}
$this->do_install($packages);
}
/**
* Really install the packages.
*
* @param array $packages Packages to install.
*/
protected function do_install($packages)
{
$managed_packages = array_merge($this->get_managed_packages(), $packages);
ksort($managed_packages);
@@ -135,12 +145,12 @@ class manager
/**
* Tells whether or not a package is managed by Composer.
*
* @param string $packages Package name
* @param string $package Package name
* @return bool
*/
public function is_managed($packages)
public function is_managed($package)
{
return array_key_exists($packages, $this->get_managed_packages());
return array_key_exists($package, $this->get_managed_packages());
}
/**
@@ -177,11 +187,15 @@ class manager
{
$normalized_packages = [];
foreach ($packages as $package)
foreach ($packages as $package => $version)
{
if (!is_array($package))
if (is_numeric($package))
{
$normalized_packages[$package] = '*';
$normalized_packages[$version] = '*';
}
else
{
$normalized_packages[$package] = $version;
}
}