Components_Runner_Installer::run PHP Method

run() public method

public run ( )
    public function run()
    {
        $options = $this->_config->getOptions();
        if (!empty($options['destination'])) {
            $environment = realpath($options['destination']);
            if (!$environment) {
                $environment = $options['destination'];
            }
        } else {
            throw new Components_Exception('You MUST specify the path to the installation environment with the --destination flag!');
        }
        if (empty($options['pearrc'])) {
            $options['pearrc'] = $environment . '/pear.conf';
            $this->_output->info(sprintf('Undefined path to PEAR configuration file (--pearrc). Assuming %s for this installation.', $options['pearrc']));
        }
        if (empty($options['horde_dir'])) {
            $options['horde_dir'] = $environment;
            $this->_output->info(sprintf('Undefined path to horde web root (--horde-dir). Assuming %s for this installation.', $options['horde_dir']));
        }
        if (!empty($options['instructions'])) {
            if (!file_exists($options['instructions'])) {
                throw new Components_Exception(sprintf('Instructions file "%s" is missing!', $options['instructions']));
            }
            $lines = explode("\n", file_get_contents($options['instructions']));
            $result = array();
            foreach ($lines as $line) {
                $trimmed = trim($line);
                if (empty($trimmed) || preg_match('/^#/', $trimmed)) {
                    continue;
                }
                preg_match('/(.*):(.*)/', $trimmed, $matches);
                $id = $matches[1];
                $c_options = $matches[2];
                foreach (explode(',', $c_options) as $option) {
                    $result[trim($id)][trim($option)] = true;
                }
            }
            $options['instructions'] = $result;
        }
        $target = $this->_factory->createEnvironment($environment, $options['pearrc']);
        $target->setResourceDirectories($options);
        //@todo: fix role handling
        $target->provideChannel('pear.horde.org', $options);
        $target->getPearConfig()->setChannels(array('pear.horde.org', true));
        $target->getPearConfig()->set('horde_dir', $options['horde_dir'], 'user', 'pear.horde.org');
        Components_Exception_Pear::catchError($target->getPearConfig()->store());
        $this->_installer->installTree($target, $this->_config->getComponent(), $options);
    }
Components_Runner_Installer