Development

Changeset 8597

You must first sign up to be able to contribute.

Changeset 8597

Show
Ignore:
Timestamp:
04/22/08 22:32:21 (6 months ago)
Author:
dwhittle
Message:

1.1: fixed task loading so project plugins override bundled plugins (closes #2880 - thanks carl)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/command/sfSymfonyCommandApplication.class.php

    r7778 r8597  
    44 * This file is part of the symfony package. 
    55 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    7777  protected function loadTasks() 
    7878  { 
    79     $dirs = array( 
    80       sfConfig::get('sf_symfony_lib_dir').'/task',               // symfony tasks 
    81       sfConfig::get('sf_symfony_lib_dir').'/plugins/*/lib/task', // bundled plugin tasks 
    82       sfConfig::get('sf_plugins_dir').'/*/lib/task',             // plugin tasks 
    83       sfConfig::get('sf_lib_dir').'/task',                       // project tasks 
    84     ); 
     79    $dirs = array(sfConfig::get('sf_symfony_lib_dir').'/task'); // symfony core tasks 
     80 
     81    // only add bundled plugins that were not overloaded in the project 
     82    $installedPlugins = sfFinder::type('dir')->maxdepth(0)->relative()->in(sfConfig::get('sf_root_dir').'/plugins'); 
     83    foreach (new DirectoryIterator(sfConfig::get('sf_symfony_lib_dir').'/plugins') as $bundledPlugin) 
     84    { 
     85      if ($bundledPlugin->isDot()) 
     86      { 
     87        continue; 
     88      } 
     89 
     90      $path = $bundledPlugin->getRealpath().'/lib/task'; 
     91      if (!in_array($bundledPlugin->getFilename(), $installedPlugins) && is_dir($path)) 
     92      { 
     93        $dirs[] = $path; 
     94      } 
     95    } 
     96 
     97    $dirs = array_merge($dirs, array(sfConfig::get('sf_plugins_dir').'/*/lib/task',             // plugin tasks 
     98                                     sfConfig::get('sf_lib_dir').'/task',                       // project tasks 
     99                                     )); 
     100 
    85101    $finder = sfFinder::type('file')->name('*Task.class.php'); 
    86102