Example #1
0
function downloadPlugin($name, $t)
{
    $manager = sfSympalPluginManager::getActionInstance($name, 'uninstall');
    $manager->uninstall(true);
    $manager = sfSympalPluginManager::getActionInstance($name, 'download');
    $manager->download();
    $t->is(file_exists(sfConfig::get('sf_plugins_dir') . '/' . $name), true, 'Test that the plugin exists and was downloaded');
}
 protected function execute($arguments = array(), $options = array())
 {
     if (!$options['no-confirmation'] && !$this->askConfirmation(array(sprintf('This command will install the plugin "%s"', $arguments['name']), 'Are you sure you want to proceed? (y/N)'), 'QUESTION_LARGE', false)) {
         $this->logSection('sympal', 'Install task aborted');
         return 1;
     }
     $databaseManager = new sfDatabaseManager($this->configuration);
     $pluginManager = sfSympalPluginManager::getActionInstance($arguments['name'], 'install', $this->configuration, $this->formatter);
     $pluginManager->install();
 }
Example #3
0
function uninstallPlugin($name, $t, $delete = true)
{
    $manager = sfSympalPluginManager::getActionInstance($name, 'uninstall');
    $manager->uninstall($delete);
    $t->is(file_exists(sfConfig::get('sf_plugins_dir') . '/' . $name), !$delete, 'Test plugin was was deleted');
    $t->is(file_exists(sfConfig::get('sf_lib_dir') . '/model/doctrine/' . $name), !$delete, 'Test plugin models were deleted');
    $t->is(file_exists(sfConfig::get('sf_lib_dir') . '/form/doctrine/' . $name), !$delete, 'Test plugin forms were deleted');
    $t->is(file_exists(sfConfig::get('sf_lib_dir') . '/filter/doctrine/' . $name), !$delete, 'Test plugin form filters were deleted');
    $t->is(file_exists(sfConfig::get('sf_web_dir') . '/' . $name), !$delete, 'Test plugin assets symlink was removed');
}
Example #4
0
function deletePlugin($name, $t)
{
    $t->info('Deleting plugin ' . $name);
    $manager = sfSympalPluginManager::getActionInstance($name, 'delete');
    $manager->delete();
    $t->is(file_exists(sfConfig::get('sf_plugins_dir') . '/' . $name), false, 'The plugin was deleted entirely');
    $t->is(file_exists(sfConfig::get('sf_lib_dir') . '/model/doctrine/' . $name), false, 'The model files were deleted');
    $t->is(file_exists(sfConfig::get('sf_lib_dir') . '/form/doctrine/' . $name), false, 'The form files were deleted');
    $t->is(file_exists(sfConfig::get('sf_lib_dir') . '/filter/doctrine/' . $name), false, 'The filter files were deleted');
}
 protected function execute($arguments = array(), $options = array())
 {
     if (!$options['no-confirmation'] && !$this->askConfirmation(array('This command will uninstall and remove the sympal plugin named ' . sfSympalPluginToolkit::getLongPluginName($arguments['name']), 'Are you sure you want to proceed? (y/N)'), 'QUESTION_LARGE', false)) {
         $this->logSection('sympal', 'Plugin uninstall aborted');
         return 1;
     }
     $databaseManager = new sfDatabaseManager($this->configuration);
     $pluginManager = sfSympalPluginManager::getActionInstance($arguments['name'], 'uninstall', $this->configuration, $this->formatter);
     $pluginManager->uninstall($options['delete']);
 }
 public function executeInstall_plugins(sfWebRequest $request)
 {
     $formatter = new sfFormatter();
     $plugins = $this->getUser()->getAttribute('sympal_install_plugins');
     foreach ($plugins as $plugin) {
         $manager = sfSympalPluginManager::getActionInstance($plugin, 'install', $this->getContext()->getConfiguration(), $formatter);
         $manager->install();
     }
     $this->getUser()->setAttribute('sympal_install_plugins', array());
     $this->getUser()->setFlash('notice', 'Sympal installed successfully!');
     $this->redirect('@sympal_dashboard');
 }
 protected function _executeAction($action, $pluginName)
 {
     try {
         sfToolkit::clearGlob(sfConfig::get('sf_cache_dir'));
         $manager = sfSympalPluginManager::getActionInstance($pluginName, $action);
         $manager->{$action}();
         sfToolkit::clearGlob(sfConfig::get('sf_cache_dir'));
         $this->getUser()->setFlash('notice', $pluginName . ' "' . $action . '" action executed successfully!');
         return true;
     } catch (Exception $e) {
         $this->getUser()->setFlash('error', $pluginName . ' "' . $action . '" action failed with error "' . $e->getMessage() . '"!' . (sfConfig::get('sf_debug') ? "<br/><br/>" . nl2br($e->getTraceAsString()) : null));
         return false;
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     if (isset($options['list-available']) && $options['list-available']) {
         $list = new sfSympalPluginListTask($this->dispatcher, $this->formatter);
         $list->setCommandApplication($this->commandApplication);
         $list->run(array(), array());
     } else {
         if (!isset($arguments['name'])) {
             throw new sfException('You must specify the plugin name to download.');
         }
         $databaseManager = new sfDatabaseManager($this->configuration);
         $pluginManager = sfSympalPluginManager::getActionInstance($arguments['name'], 'download', $this->configuration, $this->formatter);
         $pluginManager->download();
     }
 }
 /**
  * Get array of plugins which contain a content type
  *
  * @return array $contentTypePlugins
  */
 public function getContentTypePlugins()
 {
     if ($this->_contentTypePlugins === null) {
         $this->_contentTypePlugins = array();
         $plugins = $this->getPluginPaths();
         foreach ($plugins as $plugin => $path) {
             $manager = new sfSympalPluginManager($plugin, $this->_projectConfiguration, new sfFormatter());
             if ($contentType = $manager->getContentTypeForPlugin()) {
                 $this->_contentTypePlugins[] = $plugin;
             }
         }
     }
     return $this->_contentTypePlugins;
 }
 protected function _installAddonPlugins()
 {
     $this->logSection('sympal', '...installing addon plugins', null, 'COMMENT');
     $plugins = $this->_configuration->getPluginConfiguration('sfSympalPlugin')->getSympalConfiguration()->getDownloadedPlugins();
     foreach ($plugins as $plugin) {
         $manager = sfSympalPluginManager::getActionInstance($plugin, 'install', $this->_configuration, $this->_formatter);
         // Don't need to publish assets, sympal install does this at the end
         $manager->setOption('publish_assets', false);
         // Don't need to clear cache, sympal install does this at the end
         $manager->setOption('clear_cache', false);
         // Don't need to uninstall first on sympal install
         $manager->setOption('uninstall_first', false);
         // Don't need to create tables as the sympal install already did this
         $manager->setOption('create_tables', false);
         $manager->install();
     }
 }
Example #11
0
 /**
  * In the process of being reworked - basically does nothing currently,
  * calls install, but with pretty much everything turned off.
  */
 protected function _installAddonPlugins()
 {
     $this->logSection('plugins', '...installing addon plugins');
     $this->_disableOutput();
     $plugins = $this->_configuration->getPluginConfiguration('sfSympalPlugin')->getSympalConfiguration()->getDownloadedPlugins();
     foreach ($plugins as $plugin) {
         $this->logTaskCall('plugins', 'Installing %s', sprintf('(sympal:plugin-install %s --application=%s)', $plugin, $this->_application));
         $manager = sfSympalPluginManager::getActionInstance($plugin, 'install', $this->_configuration, $this->_formatter);
         // Don't need to publish assets, sympal install does this at the end
         $manager->setOption('publish_assets', false);
         // Don't need to clear cache, sympal install does this at the end
         $manager->setOption('clear_cache', false);
         // Don't need to uninstall first on sympal install
         $manager->setOption('uninstall_first', false);
         // Don't need to create tables as the sympal install already did this
         $manager->setOption('create_tables', false);
         // Don't need to clear cache, sympal install does this at the end
         $manager->setOption('load_data', false);
         $manager->install();
     }
     $this->_enableOutput();
     $this->logSection('plugins', '...plugins installed');
 }