Ticket #3407: OverloadBundledPlugins.php.patch
| File OverloadBundledPlugins.php.patch, 3.6 kB (added by Carl.Vondrick, 9 months ago) |
|---|
-
lib/command/sfSymfonyCommandApplication.class.php
old new 36 36 $this->setName('symfony'); 37 37 $this->setVersion(SYMFONY_VERSION); 38 38 39 $this->loadTasks( );39 $this->loadTasks($configuration); 40 40 } 41 41 42 42 /** … … 73 73 * Loads all available tasks. 74 74 * 75 75 * Looks for tasks in the symfony core, the current project and all project plugins. 76 * 77 * @param sfProjectConfiguration The project configuration 76 78 */ 77 protected function loadTasks( )79 protected function loadTasks(sfProjectConfiguration $configuration) 78 80 { 79 81 $dirs = array( 80 82 sfConfig::get('sf_symfony_lib_dir').'/task', // symfony tasks 81 sfConfig::get('sf_symfony_lib_dir').'/plugins/*/lib/task', // bundled plugin tasks82 sfConfig::get('sf_plugins_dir').'/*/lib/task', // plugin tasks83 83 sfConfig::get('sf_lib_dir').'/task', // project tasks 84 84 ); 85 85 $finder = sfFinder::type('file')->name('*Task.class.php'); 86 86 87 foreach ($ dirs as $globDir)87 foreach ($finder->in($dirs) as $task) 88 88 { 89 if (!$dirs = glob($globDir)) 90 { 91 continue; 92 } 89 require_once $task; 90 } 93 91 94 foreach ($finder->in($dirs) as $task) 92 foreach ($configuration->getPluginPaths() as $path) 93 { 94 $taskPath = $path.'/lib/task'; 95 if (is_dir($taskPath)) 95 96 { 96 require_once $task; 97 foreach ($finder->in($taskPath) as $task) 98 { 99 require_once $task; 100 } 97 101 } 98 102 } 99 103 } -
lib/config/sfProjectConfiguration.class.php
old new 227 227 } 228 228 229 229 /** 230 * Gets the paths to plugins root directories, minding overloaded plugins. 231 * 232 * @return array The plugin root paths. 233 */ 234 public function getPluginPaths() 235 { 236 $plugins = sfFinder::type('dir')->discard('.*')->prune('.*')->maxdepth(0)->in(sfConfig::get('sf_plugins_dir')); 237 238 $bundledPluginDir = sfConfig::get('sf_symfony_lib_dir').'/plugins'; 239 $bundledPlugins = sfFinder::type('dir')->maxdepth(0)->relative()->in($bundledPluginDir); 240 foreach ($bundledPlugins as $bundledPlugin) 241 { 242 if (!is_dir(sfConfig::get('sf_plugins_dir').'/'.$bundledPlugin)) 243 { 244 $plugins[] = $bundledPluginDir.'/'.$bundledPlugin; 245 } 246 } 247 248 return $plugins; 249 } 250 251 /** 230 252 * Returns the event dispatcher. 231 253 * 232 254 * @return sfEventDispatcher A sfEventDispatcher instance -
lib/config/sfApplicationConfiguration.class.php
old new 506 506 */ 507 507 public function loadPluginConfig() 508 508 { 509 if ($pluginConfigs = glob(sfConfig::get('sf_symfony_lib_dir').'/plugins/*/config/config.php'))509 foreach ($this->getPluginPaths() as $path) 510 510 { 511 foreach ($pluginConfigs as $config) 511 $config = $path.'/config/config.php'; 512 if (is_readable($config)) 512 513 { 513 514 require $config; 514 515 } 515 516 } 516 517 if ($pluginConfigs = glob(sfConfig::get('sf_plugins_dir').'/*/config/config.php'))518 {519 foreach ($pluginConfigs as $config)520 {521 require $config;522 }523 }524 517 } 525 518 526 519 /**