public function download()
 {
     $this->logSection('sympal', sprintf('Downloading Sympal plugin "%s"', $this->_pluginName));
     $success = false;
     try {
         $this->logSection('sympal', '...trying to download plugin via PEAR');
         chdir(sfConfig::get('sf_root_dir'));
         $pluginInstall = new sfPluginInstallTask($this->_dispatcher, $this->_formatter);
         $ret = @$pluginInstall->run(array($this->_pluginName), array());
         if (!sfSympalPluginToolkit::isPluginInstalled($this->_pluginName)) {
             $this->logSection('sympal', '...could not download plugin via PEAR', null, 'ERROR');
             $success = false;
         } else {
             $success = true;
         }
     } catch (Exception $e) {
         $success = false;
         $this->logSection('sympal', '...exception thrown while downloading from PEAR: ' . $e->getMessage(), null, 'ERROR');
     }
     if (!$success) {
         $this->logSection('sympal', 'Could not download plugin via PEAR! Trying alternative sources.');
         $path = sfSympalPluginToolkit::getPluginDownloadPath($this->_pluginName);
         if (is_dir($path)) {
             $this->logSection('sympal', sprintf('...copying plugin from local directory: "%s"', $path));
             $this->_filesystem->mirror($path, sfConfig::get('sf_plugins_dir') . '/' . $this->_pluginName, sfFinder::type('dir'));
             $this->_filesystem->mirror($path, sfConfig::get('sf_plugins_dir') . '/' . $this->_pluginName, sfFinder::type('files'));
         } else {
             $this->logSection('sympal', sprintf('...checking out plugin from SVN repository: "%s"', $path));
             $svn = exec('which svn');
             $this->_filesystem->execute($svn . ' co ' . $path . ' ' . sfConfig::get('sf_plugins_dir') . '/' . $this->_pluginName);
         }
     }
 }
예제 #2
0
 protected function execute($arguments = array(), $options = array())
 {
     // Remove E_STRICT and E_DEPRECATED from error_reporting
     error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));
     if (sfConfig::get('op_http_proxy')) {
         $config = $this->getPluginManager()->getEnvironment()->getConfig();
         $config->set('http_proxy', sfConfig::get('op_http_proxy'), 'user', 'pear.php.net');
     }
     if ($this->isSelfInstalledPlugins($arguments['name'])) {
         $str = "\"%s\" is already installed manually, so it will not be reinstalled.\n" . "If you want to manage it automatically, delete it manually and retry this command.";
         $this->logBlock(sprintf($str, $arguments['name']), 'INFO');
         return false;
     }
     try {
         $isExists = $this->isPluginExists($arguments['name']);
         parent::execute($arguments, $options);
         if (count(sfFinder::type('file')->name('databases.yml')->in(sfConfig::get('sf_config_dir'))) && !$isExists) {
             $databaseManager = new sfDatabaseManager($this->configuration);
             Doctrine::getTable('SnsConfig')->set($arguments['name'] . '_needs_data_load', '1');
         }
     } catch (sfPluginException $e) {
         $this->logBlock($e->getMessage(), 'ERROR');
         return false;
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     // Remove E_STRICT and E_DEPRECATED from error_reporting
     error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));
     if (empty($options['channel'])) {
         $options['channel'] = opPluginManager::getDefaultPluginChannelServerName();
     }
     $manager = $this->getPluginManager($options['channel']);
     if (sfConfig::get('op_http_proxy')) {
         $config = $this->getPluginManager()->getEnvironment()->getConfig();
         $config->set('http_proxy', sfConfig::get('op_http_proxy'), 'user', 'pear.php.net');
     }
     if ($this->isSelfInstalledPlugins($arguments['name'], $options['channel'])) {
         $str = "\"%s\" is already installed manually, so it will not be reinstalled.\n" . "If you want to manage it automatically, delete it manually and retry this command.";
         $this->logBlock(sprintf($str, $arguments['name']), 'INFO');
         return false;
     }
     try {
         $isExists = $this->isPluginExists($arguments['name']);
         parent::execute($arguments, $options);
         if (count(sfFinder::type('file')->name('databases.yml')->in(sfConfig::get('sf_config_dir'))) && !$isExists) {
             $databaseManager = new sfDatabaseManager($this->configuration);
             if ($this->isSnsConfigTableExists()) {
                 Doctrine::getTable('SnsConfig')->set($arguments['name'] . '_needs_data_load', '1');
             }
         }
     } catch (sfPluginException $e) {
         $this->logBlock($e->getMessage(), 'ERROR');
         $registry = $this->getPluginManager()->getEnvironment()->getRegistry();
         $dependency = opPluginDownloader::getCachedDependency($options['channel'], $arguments['name']);
         if ($dependency && $dependency->hasFailedDependency()) {
             $message = array('', $this->formatter->format('You must resolve the following failed dependency to install this plugin:', 'INFO'), '');
             foreach ($dependency->failedDependency['package'] as $dep) {
                 $message['package'] = $this->formatter->format('Packages and plugins:', 'COMMENT');
                 $depname = $dependency->_getExtraString($dep);
                 if (array_key_exists('conflicts', $dep)) {
                     $depname = ' ' . $this->formatter->format('(conflicts - please uninstall this)', 'ERROR');
                 }
                 $message[] = '  ' . $registry->parsedPackageNameToString($dep, true) . $depname;
             }
             foreach ($dependency->failedDependency['extension'] as $dep) {
                 $message['extension'] = $this->formatter->format('Extensions:', 'COMMENT');
                 $message[] = '  ' . $dep['name'] . $dependency->_getExtraString($dep);
             }
             if ($dependency->failedDependency['php']) {
                 $dep = $dependency->failedDependency['php'];
                 $message[] = $this->formatter->format('PHP:', 'COMMENT');
                 $message[] = $dependency->_getExtraString($dep);
             }
             if ($dependency->failedDependency['pearinstaller']) {
                 $dep = $dependency->failedDependency['pearinstaller'];
                 $message[] = $this->formatter->format('PEAR:', 'COMMENT');
                 $message[] = $dependency->_getExtraString($dep);
             }
             $this->log($message);
         }
         return false;
     }
 }