getChannel() public method

Return the channel of the component.
public getChannel ( ) : string
return string The component channel.
Beispiel #1
0
 /**
  * List a Horde component as dependency.
  *
  * @param Components_Component $component The component for which the
  *                                        dependency tree should be shown     * @param int                  $level     The current list level.
  * @param string               $parent    Name of the parent element.
  * @param array                $options   Options for generating the list.
  *
  * @return boolean True in case listing should continue.
  */
 private function _listComponent(Components_Component $component, $level, $parent, $options)
 {
     $key = $component->getName() . '/' . $component->getChannel();
     if (in_array($key, array_keys($this->_displayed_dependencies))) {
         if (empty($this->_displayed_dependencies[$key])) {
             $add = '(RECURSION) ***STOP***';
         } else {
             $add = '(ALREADY LISTED WITH ' . $this->_displayed_dependencies[$key] . ') ***STOP***';
         }
     } else {
         $add = '';
     }
     $this->_element($component->getChannel() == 'pear.horde.org' ? 'green' : 'yellow', $level, $key, $component->getName() . '-' . $component->getVersion(), $component->getChannel(), $add, $options);
     if (in_array($key, array_keys($this->_displayed_dependencies))) {
         return false;
     } else {
         $this->_displayed_dependencies[$key] = $parent;
         return true;
     }
 }
Beispiel #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()));
                 }
             }
         }
     }
 }