Changeset 20053
- Timestamp:
- 07/09/09 14:49:20 (4 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/command/sfSymfonyCommandApplication.class.php
r20049 r20053 19 19 class sfSymfonyCommandApplication extends sfCommandApplication 20 20 { 21 protected $task Dirs = array();21 protected $taskFiles = array(); 22 22 23 23 /** … … 91 91 { 92 92 // Symfony core tasks 93 $ this->taskDirs = array(sfConfig::get('sf_symfony_lib_dir').'/task');93 $dirs = array(sfConfig::get('sf_symfony_lib_dir').'/task'); 94 94 95 95 // Plugin tasks … … 98 98 if (is_dir($taskPath = $path.'/lib/task')) 99 99 { 100 $ this->taskDirs[] = $taskPath;100 $dirs[] = $taskPath; 101 101 } 102 102 } 103 103 104 104 // project tasks 105 $ this->taskDirs[] = sfConfig::get('sf_lib_dir').'/task';105 $dirs[] = sfConfig::get('sf_lib_dir').'/task'; 106 106 107 // require tasks108 107 $finder = sfFinder::type('file')->name('*Task.class.php'); 108 foreach ($finder->in($dirs) as $file) 109 { 110 $this->taskFiles[basename($file, '.class.php')] = $file; 111 } 109 112 110 113 // register local autoloader for tasks 111 114 spl_autoload_register(array($this, 'autoloadTask')); 112 115 113 foreach ($finder->in($this->taskDirs) as $task) 116 // require tasks 117 foreach ($this->taskFiles as $task => $file) 114 118 { 115 119 // forces autoloading of each task class 116 class_exists( basename($task, '.class.php'), true);120 class_exists($task, true); 117 121 } 118 122 … … 130 134 public function autoloadTask($class) 131 135 { 132 foreach ($this->taskDirs as $dir)136 if (isset($this->taskFiles[$class])) 133 137 { 134 if (file_exists($file = $dir.'/'.$class.'.class.php')) 135 { 136 require_once $file; 138 require_once $this->taskFiles[$class]; 137 139 138 return true; 139 } 140 return true; 140 141 } 141 142 branches/1.2/lib/command/sfSymfonyCommandApplication.class.php
r20049 r20053 19 19 class sfSymfonyCommandApplication extends sfCommandApplication 20 20 { 21 protected $task Dirs = array();21 protected $taskFiles = array(); 22 22 23 23 /** … … 91 91 { 92 92 // Symfony core tasks 93 $ this->taskDirs = array(sfConfig::get('sf_symfony_lib_dir').'/task');93 $dirs = array(sfConfig::get('sf_symfony_lib_dir').'/task'); 94 94 95 95 // Plugin tasks … … 98 98 if (is_dir($taskPath = $path.'/lib/task')) 99 99 { 100 $ this->taskDirs[] = $taskPath;100 $dirs[] = $taskPath; 101 101 } 102 102 } 103 103 104 104 // project tasks 105 $ this->taskDirs[] = sfConfig::get('sf_lib_dir').'/task';105 $dirs[] = sfConfig::get('sf_lib_dir').'/task'; 106 106 107 // require tasks108 107 $finder = sfFinder::type('file')->name('*Task.class.php'); 108 foreach ($finder->in($dirs) as $file) 109 { 110 $this->taskFiles[basename($file, '.class.php')] = $file; 111 } 109 112 110 113 // register local autoloader for tasks 111 114 spl_autoload_register(array($this, 'autoloadTask')); 112 115 113 foreach ($finder->in($this->taskDirs) as $task) 116 // require tasks 117 foreach ($this->taskFiles as $task => $file) 114 118 { 115 119 // forces autoloading of each task class 116 class_exists( basename($task, '.class.php'), true);120 class_exists($task, true); 117 121 } 118 122 … … 130 134 public function autoloadTask($class) 131 135 { 132 foreach ($this->taskDirs as $dir)136 if (isset($this->taskFiles[$class])) 133 137 { 134 if (file_exists($file = $dir.'/'.$class.'.class.php')) 135 { 136 require_once $file; 138 require_once $this->taskFiles[$class]; 137 139 138 return true; 139 } 140 return true; 140 141 } 141 142 branches/1.3/lib/command/sfSymfonyCommandApplication.class.php
r20049 r20053 19 19 class sfSymfonyCommandApplication extends sfCommandApplication 20 20 { 21 protected $task Dirs = array();21 protected $taskFiles = array(); 22 22 23 23 /** … … 91 91 { 92 92 // Symfony core tasks 93 $ this->taskDirs = array(sfConfig::get('sf_symfony_lib_dir').'/task');93 $dirs = array(sfConfig::get('sf_symfony_lib_dir').'/task'); 94 94 95 95 // Plugin tasks … … 98 98 if (is_dir($taskPath = $path.'/lib/task')) 99 99 { 100 $ this->taskDirs[] = $taskPath;100 $dirs[] = $taskPath; 101 101 } 102 102 } 103 103 104 104 // project tasks 105 $ this->taskDirs[] = sfConfig::get('sf_lib_dir').'/task';105 $dirs[] = sfConfig::get('sf_lib_dir').'/task'; 106 106 107 // require tasks108 107 $finder = sfFinder::type('file')->name('*Task.class.php'); 108 foreach ($finder->in($dirs) as $file) 109 { 110 $this->taskFiles[basename($file, '.class.php')] = $file; 111 } 109 112 110 113 // register local autoloader for tasks 111 114 spl_autoload_register(array($this, 'autoloadTask')); 112 115 113 foreach ($finder->in($this->taskDirs) as $task) 116 // require tasks 117 foreach ($this->taskFiles as $task => $file) 114 118 { 115 119 // forces autoloading of each task class 116 class_exists( basename($task, '.class.php'), true);120 class_exists($task, true); 117 121 } 118 122 … … 130 134 public function autoloadTask($class) 131 135 { 132 foreach ($this->taskDirs as $dir)136 if (isset($this->taskFiles[$class])) 133 137 { 134 if (file_exists($file = $dir.'/'.$class.'.class.php')) 135 { 136 require_once $file; 138 require_once $this->taskFiles[$class]; 137 139 138 return true; 139 } 140 return true; 140 141 } 141 142