protected function execute($arguments = array(), $options = array()) { if (empty($options['channel'])) { $options['channel'] = opPluginManager::getDefaultPluginChannelServerName(); } return parent::execute($arguments, $options); }
public function setup() { require_once dirname(__FILE__) . '/../config/opSecurityConfigHandler.class.php'; $DS = DIRECTORY_SEPARATOR; $OpenPNE2Path = sfConfig::get('sf_lib_dir') . $DS . 'vendor' . $DS; // ##PROJECT_LIB_DIR##/vendor/ set_include_path($OpenPNE2Path . PATH_SEPARATOR . get_include_path()); $result = parent::setup(); if (0 !== strpos(sfConfig::get('sf_task_name'), 'sfDoctrineBuild')) { $configCache = $this->getConfigCache(); $file = $configCache->checkConfig('data/config/plugin.yml', true); if ($file) { include $file; } require_once dirname(__FILE__) . '/../plugin/opPluginManager.class.php'; $pluginActivations = opPluginManager::getPluginActivationList(); $pluginActivations = array_merge(array_fill_keys($this->getPlugins(), true), $pluginActivations); foreach ($pluginActivations as $key => $value) { if (!in_array($key, $this->getPlugins())) { unset($pluginActivations[$key]); } } $pluginActivations = $this->filterSkinPlugins($pluginActivations); $this->enablePlugins(array_keys($pluginActivations, true)); $this->disablePlugins(array_keys($pluginActivations, false)); unset($this->cache['getPluginPaths']); // it should be rewrited $this->plugins = array_unique($this->plugins); } return $result; }
protected function getPluginList() { $list = array(); $config = null; if ($proxy = parse_url(sfConfig::get('op_http_proxy'))) { $config = array('adapter' => 'Zend_Http_Client_Adapter_Proxy'); if (isset($proxy['host'])) { $config['proxy_host'] = $proxy['host']; } if (isset($proxy['port'])) { $config['proxy_port'] = $proxy['port']; } if (isset($proxy['user'])) { $config['proxy_user'] = $proxy['user']; } if (isset($proxy['pass'])) { $config['proxy_pass'] = $proxy['pass']; } } try { $client = new Zend_Http_Client(opPluginManager::getPluginListBaseUrl() . OPENPNE_VERSION . '.yml', $config); $response = $client->request(); if ($response->isSuccessful()) { $list = sfYaml::load($response->getBody()); $list = $this->applyLocalPluginList($list); } else { $str = "Failed to download plugin list."; $this->logBlock($str, 'ERROR'); } } catch (Zend_Http_Client_Adapter_Exception $e) { $str = "Failed to download plugins list."; $this->logBlock($str, 'ERROR'); } return $list; }
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(); } } }
private function __construct($pluginName, sfEventDispatcher $dispatcher) { $this->name = $pluginName; $config = sfConfig::get('op_plugin_activation', array()); 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::OPENPNE_PLUGIN_CHANNEL); if ($package) { $this->version = $package->getVersion(); $this->summary = $package->getSummary(); } } }
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; } }
public function setup() { require_once dirname(__FILE__) . '/../config/opSecurityConfigHandler.class.php'; $DS = DIRECTORY_SEPARATOR; $OpenPNE2Path = sfConfig::get('sf_lib_dir') . $DS . 'vendor' . $DS; // ##PROJECT_LIB_DIR##/vendor/ set_include_path($OpenPNE2Path . PATH_SEPARATOR . get_include_path()); $result = parent::setup(); $configCache = $this->getConfigCache(); $file = $configCache->checkConfig('data/config/plugin.yml', true); if ($file) { include $file; } require_once dirname(__FILE__) . '/../plugin/opPluginManager.class.php'; $pluginActivations = opPluginManager::getPluginActivationList(); $pluginActivations = array_merge(array_fill_keys($this->getPlugins(), true), $pluginActivations); foreach ($pluginActivations as $key => $value) { if (!in_array($key, $this->getPlugins())) { unset($pluginActivations[$key]); } } $pluginActivations = $this->filterSkinPlugins($pluginActivations); $this->enablePlugins(array_keys($pluginActivations, true)); $this->disablePlugins(array_keys($pluginActivations, false)); unset($this->cache['getPluginPaths']); // it should be rewrited $this->plugins = array_unique($this->plugins); // gadget include $this->getConfigCache()->checkConfig('config/gadget_layout_config.yml'); include $this->getConfigCache()->checkConfig('config/gadget_config.yml'); require_once sfConfig::get('sf_lib_dir') . '/config/opGadgetConfigHandler.class.php'; $gadgetConfigs = sfConfig::get('op_gadget_config', array()); foreach ($gadgetConfigs as $key => $config) { $filename = 'config/' . sfInflector::underscore($key); $params = array(); if ($key != 'gadget') { $filename .= '_gadget'; $params['prefix'] = sfInflector::underscore($key) . '_'; } $filename .= '.yml'; $this->getConfigCache()->registerConfigHandler($filename, 'opGadgetConfigHandler', $params); include $this->getConfigCache()->checkConfig($filename); } return $result; }
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); }