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
function generatePlugin($name, $contentType, $t)
{
    global $configuration;
    $generate = new sfSympalPluginGenerateTask($configuration->getEventDispatcher(), new sfFormatter());
    $generate->run(array($name), array('--re-generate', '--no-confirmation', '--content-type=' . $contentType));
    $t->is(file_exists(sfConfig::get('sf_plugins_dir') . '/' . sfSympalPluginToolkit::getLongPluginName($name)), true, 'Test that the plugin was generated');
}
 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']);
 }
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $plugins = sfSympalPluginToolkit::getAvailablePlugins();
     $api = new sfSympalPluginApi();
     if ($api->getUsername() && $api->getPassword()) {
         foreach ($plugins as $plugin) {
             $result = $api->put('plugins/' . $plugin . '/users.xml');
             if ($result['status'] == 1) {
                 $this->logSection('sympal', 'Reported use of "' . $plugin . '"...');
             }
         }
     } else {
         throw new sfException('You must specify a username and password for the Symfony plugins api in your Sympal configuration.');
     }
 }
 protected function execute($arguments = array(), $options = array())
 {
     $plugins = sfSympalPluginToolkit::getAvailablePlugins();
     if (isset($options['search']) && $options['search']) {
         $this->logSection('sympal', 'Searching for "' . $options['search'] . '"');
         $this->search = $options['search'];
         $plugins = array_filter($plugins, array($this, '_searchPlugins'));
     }
     if (!empty($plugins)) {
         $this->logSection('sympal', 'Found ' . count($plugins) . ' Sympal Plugin(s)');
         $this->logSection('sympal', str_repeat('-', 30));
         foreach ($plugins as $plugin) {
             $name = sfSympalPluginToolkit::getShortPluginName($plugin);
             $this->logSection('sympal', $plugin);
             $this->logSection('sympal', "\$ php symfony sympal:plugin-download " . $name);
             $this->logSection('sympal', "\$ php symfony sympal:plugin-install " . $name);
             $this->logSection('sympal', null);
         }
     } else {
         throw new sfException('No sympal plugins found');
     }
 }
 /**
  * Get array of available addon plugins
  *
  * @return array $addonPlugins
  */
 public function getDownloadablePlugins()
 {
     return sfSympalPluginToolkit::getDownloadablePlugins();
 }
예제 #7
0
 public function getContentTypeForPlugin($name = null)
 {
     $name = $this->_pluginName;
     try {
         $pluginName = sfSympalPluginToolkit::getLongPluginName($name);
         $path = ProjectConfiguration::getActive()->getPluginConfiguration($pluginName)->getRootDir();
         $files = glob($path . '/config/doctrine/*.yml');
         if (!empty($files)) {
             $array = array();
             foreach ($files as $file) {
                 $array = array_merge($array, (array) sfYaml::load($file));
             }
             foreach ($array as $modelName => $model) {
                 if (isset($model['actAs']) && !empty($model['actAs'])) {
                     foreach ($model['actAs'] as $key => $value) {
                         if (is_numeric($key)) {
                             $name = $value;
                         } else {
                             $name = $key;
                         }
                         if ($name == 'sfSympalContentTypeTemplate') {
                             return $modelName;
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
     }
     return false;
 }
예제 #8
0
 /**
  * Whether or not the plugin has actuall been downloaded
  * 
  * @param string $plugin The short (Blog) or long (sfSympalBlogPlugin) name of the plugin
  */
 public static function isPluginDownloaded($plugin)
 {
     $pluginName = sfSympalPluginToolkit::getLongPluginName($plugin);
     return is_dir(self::getPluginPath($pluginName)) ? true : false;
 }
예제 #9
0
  <ul>
    <?php 
    foreach ($sf_sympal_plugins as $sf_sympal_plugin) {
        ?>
      <?php 
        if (isset($link) && $link) {
            ?>
        <li><?php 
            echo link_to(sfSympalPluginToolkit::getShortPluginName($sf_sympal_plugin), '@sympal_plugin_manager_view?plugin=' . $sf_sympal_plugin);
            ?>
</li>
      <?php 
        } else {
            ?>
        <li><?php 
            echo sfSympalPluginToolkit::getShortPluginName($sf_sympal_plugin);
            ?>
</li>
      <?php 
        }
        ?>
    <?php 
    }
    ?>
  </ul>
<?php 
} else {
    ?>
  <p><strong><?php 
    echo __('No Plugins Found');
    ?>
예제 #10
0
 public function getTitle()
 {
     return sfInflector::humanize(sfInflector::tableize(sfSympalPluginToolkit::getShortPluginName($this->getName())));
 }
예제 #11
0
<?php

$app = 'sympal';
require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
$t = new lime_test(2);
$t->info('1 - Test ::getPluginPath()');
$t->is(sfSympalPluginToolkit::getPluginPath('fakePlugin'), false, '::getPluginPath() returns false for a non-existent plugin');
$t->is(sfSympalPluginToolkit::getPluginPath('sfSympalBlogPlugin'), sfConfig::get('sf_plugins_dir') . '/sfSympalBlogPlugin', '::getPluginPath() returns the absolute path to a real plugin');