provideChannel() public method

Ensure the specified channel exists within the install location.
public provideChannel ( string $channel, array $options = [], string $reason = '' ) : null
$channel string The channel name.
$options array Install options.
$reason string Optional reason for adding the channel.
return null
Esempio n. 1
0
 /**
  * Install the channel of this component in the environment.
  *
  * @param Components_Pear_Environment $env     The environment to install
  *                                             into.
  * @param array                       $options Install options.
  *
  * @return NULL
  */
 public function installChannel(Components_Pear_Environment $env, $options = array())
 {
     $channel = $this->getChannel();
     if (!empty($channel)) {
         $env->provideChannel($channel, $options, sprintf(' [required by %s]', $this->getName()));
     }
 }
Esempio n. 2
0
 /**
  * Install the dependencies of a component.
  *
  * @param Components_Pear_Environment     $environment The environment we
  *                                                     install into.
  * @param Components_Component            $component   The component that
  *                                                     should be installed.
  * @param array                           $options     Install options.
  * @param string                          $reason      Optional reason for
  *                                                     adding the package.
  *
  * @return NULL
  */
 private function _installDependencies(Components_Pear_Environment $environment, Components_Component $component, $options = array(), $reason = '')
 {
     foreach ($component->getDependencyList() as $dependency) {
         if (!$dependency->isPhp() && $dependency->isPackage()) {
             $c_options = $this->_getPerComponentOptions($dependency, $options);
             if ($dependency->isRequired() || !empty($c_options['include'])) {
                 $dep = $dependency->getComponent($c_options);
                 if (!$dep instanceof Components_Component_Archive && !empty($options['build_distribution'])) {
                     if (empty($options['allow_remote']) && !$component instanceof Components_Component_Source) {
                         throw new Components_Exception(sprintf('Cannot add component "%s". Remote access has been disabled (activate with --allow-remote)!', $channel));
                     }
                     if (!empty($options['sourcepath'])) {
                         $source = $options['sourcepath'] . '/' . $component->getChannel();
                         if (!file_exists($source)) {
                             @mkdir(dirname($source), 0777, true);
                         }
                         if ($dep instanceof Components_Component_Source) {
                             $environment->provideChannel($dep->getChannel(), $options, sprintf(' [required by %s]', $dep->getName()));
                         }
                         $dep->placeArchive($source);
                         if ($dep instanceof Components_Component_Remote) {
                             $this->_output->warn(sprintf('Downloaded component %s via network to %s.', $dep->getName(), $source));
                         } else {
                             $this->_output->ok(sprintf('Generated archive for component %s in %s.', $dep->getName(), $source));
                         }
                         $dep = $dependency->getComponent($c_options);
                     }
                 }
                 if ($dep === false) {
                     throw new Components_Exception(sprintf('Failed resolving component %s/%s!', $dependency->getChannel(), $dependency->getName()));
                 } else {
                     $this->installTree($environment, $dep, $options, sprintf(' [required by %s]', $component->getName()));
                 }
             }
         }
     }
 }