* environment. The channels are only going to be installed once during the
* installation run represented by this instance.
*
+ * @param array $channels The channels to install.
+ * @param string $reason Optional reason for adding the channels.
+ *
* @return NULL
*/
- public function installChannelsOnce(array $channels)
+ public function installChannelsOnce(array $channels, $reason = '')
{
foreach ($channels as $channel) {
if (!in_array($channel, $this->_installed_channels)) {
- $this->_environment->provideChannel($channel);
+ $this->_environment->provideChannel($channel, $reason);
$this->_installed_channels[] = $channel;
}
}
*
* @param string $package The package that should be installed.
* @param string $channel The channel of the package.
+ * @param string $reason Optional reason for adding the package.
*
* @return NULL
*/
- public function installExternalPackageOnce($channel, $package)
+ public function installExternalPackageOnce($channel, $package, $reason = '')
{
$key = $channel . '/' . $package;
if (!in_array($key, $this->_installed_packages)) {
$this->_environment->addPackageFromPackage(
- $channel, $package
+ $channel, $package, $reason
);
$this->_installed_packages[] = $key;
}
*
* @param string $package_file The package file indicating which Horde
* source package should be installed.
+ * @param string $reason Optional reason for adding the package.
*
* @return NULL
*/
- public function installHordePackageOnce($package_file)
+ public function installHordePackageOnce($package_file, $reason = '')
{
if (!in_array($package_file, $this->_installed_packages)) {
$this->_environment->addPackageFromSource(
- $package_file
+ $package_file, $reason
);
$this->_installed_packages[] = $package_file;
}
return;
}
$visited[] = $this->_package_file;
- $run->installChannelsOnce($this->_package->listAllRequiredChannels());
+ $reason = sprintf(' [required by %s]', $this->_package->getName());
+ $run->installChannelsOnce($this->_package->listAllRequiredChannels(), $reason);
foreach ($this->_package->listAllExternalDependencies() as $dependency) {
+ // Refrain from installing optional pecl packages
+ if (isset($dependency['optional'])
+ && $dependency['optional'] != 'no'
+ && $dependency['channel'] == 'pecl.php.net') {
+ continue;
+ }
$run->installExternalPackageOnce(
- $dependency['channel'], $dependency['name']
+ $dependency['channel'], $dependency['name'], $reason
);
}
foreach (
) {
$child->installInTree($run, $visited);
}
- $run->installHordePackageOnce($this->_package_file);
+ $run->installHordePackageOnce($this->_package_file, $reason);
}
/**
* Add a channel within the install location.
*
* @param string $channel The channel name.
+ * @param string $reason Optional reason for adding the channel.
*
* @return NULL
*/
- public function addChannel($channel)
+ public function addChannel($channel, $reason = '')
{
$channel_handler = new PEAR_Command_Channels(
new PEAR_Frontend_CLI(),
}
$this->_output->ok(
sprintf(
- 'Successfully added channel %s',
- $channel
+ 'Successfully added channel %s%s',
+ $channel,
+ $reason
)
);
}
* Ensure the specified channel exists within the install location.
*
* @param string $channel The channel name.
+ * @param string $reason Optional reason for adding the channel.
*
* @return NULL
*/
- public function provideChannel($channel)
+ public function provideChannel($channel, $reason = '')
{
if (!$this->channelExists($channel)) {
- $this->addChannel($channel);
+ $this->addChannel($channel, $reason);
}
}
* Ensure the specified channels exists within the install location.
*
* @param array $channels The list of channels.
+ * @param string $reason Optional reason for adding the channels.
*
* @return NULL
*/
- public function provideChannels(array $channels)
+ public function provideChannels(array $channels, $reason = '')
{
foreach ($channels as $channel) {
- $this->provideChannel($channel);
+ $this->provideChannel($channel, $reason);
}
}
* Add a package based on a source directory.
*
* @param string $package The path to the package.xml in the source directory.
+ * @param string $reason Optional reason for adding the package.
*
* @return NULL
*/
- public function addPackageFromSource($package)
+ public function addPackageFromSource($package, $reason = '')
{
$installer = $this->getInstallationHandler();
ob_start();
$this->_output->pear(ob_get_clean());
$this->_output->ok(
sprintf(
- 'Successfully added package %s',
- $package
+ 'Successfully added package %s%s',
+ $package,
+ $reason
)
);
}
*
* @param string $channel The channel name for the package.
* @param string $package The name of the package of the path of the tarball.
+ * @param string $reason Optional reason for adding the package.
*
* @return NULL
*/
- public function addPackageFromPackage($channel, $package)
+ public function addPackageFromPackage($channel, $package, $reason = '')
{
$installer = $this->getInstallationHandler();
if ($local = $this->_identifyMatchingLocalPackage($package)) {
}
$this->_output->ok(
sprintf(
- 'Successfully added package %s',
- $package
+ 'Successfully added package %s%s',
+ $package,
+ $reason
)
);
}