protected function execute($arguments = array(), $options = array())
 {
     if (empty($options['channel'])) {
         $options['channel'] = opPluginManager::getDefaultPluginChannelServerName();
     }
     return parent::execute($arguments, $options);
 }
 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();
     }
     require_once 'PEAR/PackageFileManager2.php';
     $pluginName = $arguments['name'];
     $pluginDirectory = sfConfig::get('sf_plugins_dir') . '/' . $pluginName . '/';
     $info = $this->getPluginManager($options['channel'])->getPluginInfo($pluginName);
     if (!$info) {
         $info = array('n' => $pluginName, 'c' => $options['channel'], 'l' => 'Apache', 's' => $pluginName, 'd' => $pluginName);
     }
     $packageXml = new PEAR_PackageFileManager2();
     $packageOptions = array('packagedirectory' => $pluginDirectory, 'filelistgenerator' => 'file', 'baseinstalldir' => '/');
     $e = $packageXml->setOptions($packageOptions);
     if (PEAR::isError($e)) {
         echo $e->getMessage();
         exit;
     }
     $packageXml->_options['roles'] = array('*' => 'data');
     $maintainers = $this->getPluginManager()->getPluginMaintainer($pluginName);
     foreach ($maintainers as $maintainer) {
         $packageXml->addMaintainer($maintainer['r'], $maintainer['h'], $maintainer['n'], '');
     }
     $packageXml->setPackage($pluginName);
     $packageXml->setChannel($options['channel']);
     $packageXml->setReleaseVersion($arguments['version']);
     $packageXml->setReleaseStability($arguments['stability']);
     $packageXml->setApiVersion($arguments['version']);
     $packageXml->setApiStability($arguments['stability']);
     $packageXml->setNotes($arguments['note']);
     $packageXml->generateContents();
     $packageXml->setPackageType('php');
     $packageXml = $this->setDpendencies($packageXml, $pluginDirectory);
     if (isset($info['l'])) {
         $packageXml->setLicense($info['l']);
     }
     if (isset($info['s'])) {
         $packageXml->setSummary($info['s']);
     }
     if (isset($info['d'])) {
         $packageXml->setDescription($info['d']);
     }
     $e = $packageXml->writePackageFile();
     if (PEAR::isError($e)) {
         echo $e->getMessage();
         exit;
     }
 }
Exemple #3
0
 private function __construct($pluginName, sfEventDispatcher $dispatcher)
 {
     $this->name = $pluginName;
     $config = opPluginManager::getPluginActivationList();
     if (isset($config[$pluginName])) {
         $this->isActive = $config[$pluginName];
     }
     $info = $this->getPackageInfo();
     if ($info) {
         $this->version = (string) $info->version->release;
         $this->summary = (string) $info->summary;
     } else {
         $manager = new opPluginManager($dispatcher);
         $package = $manager->getEnvironment()->getRegistry()->getPackage($pluginName, opPluginManager::getDefaultPluginChannelServerName());
         if ($package) {
             $this->version = $package->getVersion();
             $this->summary = $package->getSummary();
         }
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     $name = $arguments['name'];
     $dir = $arguments['dir'];
     if (empty($options['channel'])) {
         $options['channel'] = opPluginManager::getDefaultPluginChannelServerName();
     }
     while (!($version = $this->ask('Type plugin version')) || !preg_match('/^[.\\d]+(alpha|beta|rc)?[.\\d]*$/i', $version)) {
         $this->logBlock('invalid format.', 'ERROR');
     }
     while (!($stability = $this->ask('Choose stability (stable, alpha, beta or devel)')) || !in_array($stability, array('stable', 'alpha', 'beta', 'devel'))) {
         $this->logBlock('invalid format.', 'ERROR');
     }
     while (!($note = $this->ask('Type release note'))) {
     }
     $this->logBlock('These informations are inputed:', 'COMMENT');
     $this->log($this->formatList(array('The Plugin Name     ' => $name, 'The Plugin Version  ' => $version, 'The Plugin Stability' => $stability, 'The Release note    ' => $note)));
     if ($this->askConfirmation('Is it OK to start this task? (y/n)')) {
         $this->doRelease($name, $version, $stability, $note, $dir, $options['channel']);
         $this->clearCache();
     }
 }
 public function isSelfInstalledPlugins($pluginName, $channel = null)
 {
     if (!$this->isPluginExists($pluginName)) {
         return false;
     }
     if (is_null($channel)) {
         $channel = opPluginManager::getDefaultPluginChannelServerName();
     }
     $registry = $this->getPluginManager()->getEnvironment()->getRegistry();
     return !(bool) $registry->getPackage($pluginName, $channel);
 }