예제 #1
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']);
 }
예제 #3
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;
 }
예제 #4
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;
 }