| 285 | | // make sure our modules directory exists |
|---|
| 286 | | if (is_readable($sf_app_module_dir = sfConfig::get('sf_app_module_dir'))) |
|---|
| 287 | | { |
|---|
| 288 | | // ignore names |
|---|
| 289 | | $ignore = array('.', '..', 'CVS', '.svn'); |
|---|
| 290 | | |
|---|
| 291 | | // create a file pointer to the module dir |
|---|
| 292 | | $fp = opendir($sf_app_module_dir); |
|---|
| 293 | | |
|---|
| 294 | | // loop through the directory and grab the modules |
|---|
| 295 | | while (($directory = readdir($fp)) !== false) |
|---|
| 296 | | { |
|---|
| 297 | | if (!in_array($directory, $ignore)) |
|---|
| 298 | | { |
|---|
| 299 | | $configPath = $sf_app_module_dir.'/'.$directory.'/'.sfConfig::get('sf_app_module_config_dir_name').'/config_handlers.yml'; |
|---|
| 300 | | |
|---|
| 301 | | if (is_readable($configPath)) |
|---|
| 302 | | { |
|---|
| 303 | | // initialize the root configuration handler with this module name |
|---|
| 304 | | $params = array('module_level' => true, 'module_name' => $directory); |
|---|
| 305 | | |
|---|
| 306 | | $this->handlers['config_handlers.yml']->initialize($params); |
|---|
| 307 | | |
|---|
| 308 | | // replace module dir path with a special keyword that |
|---|
| 309 | | // checkConfig knows how to use |
|---|
| 310 | | $configPath = sfConfig::get('sf_app_module_dir_name').'/'.$directory.'/'.sfConfig::get('sf_app_module_config_dir_name').'/config_handlers.yml'; |
|---|
| 311 | | |
|---|
| 312 | | require_once($this->checkConfig($configPath)); |
|---|
| 313 | | } |
|---|
| 314 | | } |
|---|
| 315 | | } |
|---|
| 316 | | |
|---|
| 317 | | // close file pointer |
|---|
| 318 | | fclose($fp); |
|---|
| 319 | | } |
|---|
| 320 | | else |
|---|
| 321 | | { |
|---|
| 322 | | // module directory doesn't exist or isn't readable |
|---|
| 323 | | throw new sfConfigurationException(sprintf('Module directory "%s" does not exist or is not readable.', sfConfig::get('sf_app_module_dir'))); |
|---|
| 324 | | } |
|---|
| | 285 | // checks modules directory exists |
|---|
| | 286 | if (!is_readable($sf_app_modules_dir = sfConfig::get('sf_app_modules_dir'))) |
|---|
| | 287 | { |
|---|
| | 288 | return; |
|---|
| | 289 | } |
|---|
| | 290 | |
|---|
| | 291 | // ignore names |
|---|
| | 292 | $ignore = array('.', '..', 'CVS', '.svn'); |
|---|
| | 293 | |
|---|
| | 294 | // create a file pointer to the module dir |
|---|
| | 295 | $fp = opendir($sf_app_modules_dir); |
|---|
| | 296 | |
|---|
| | 297 | // loop through the directory and grab the modules |
|---|
| | 298 | while (($directory = readdir($fp)) !== false) |
|---|
| | 299 | { |
|---|
| | 300 | if (in_array($directory, $ignore)) |
|---|
| | 301 | { |
|---|
| | 302 | continue; |
|---|
| | 303 | } |
|---|
| | 304 | |
|---|
| | 305 | $configPath = $sf_app_modules_dir.'/'.$directory.'/'.sfConfig::get('sf_app_module_config_dir_name').'/config_handlers.yml'; |
|---|
| | 306 | |
|---|
| | 307 | if (is_readable($configPath)) |
|---|
| | 308 | { |
|---|
| | 309 | // initialize the root configuration handler with this module name |
|---|
| | 310 | $params = array('module_level' => true, 'module_name' => $directory); |
|---|
| | 311 | |
|---|
| | 312 | $this->handlers['config_handlers.yml']->initialize($params); |
|---|
| | 313 | |
|---|
| | 314 | // replace module dir path with a special keyword that |
|---|
| | 315 | // checkConfig knows how to use |
|---|
| | 316 | $configPath = sfConfig::get('sf_app_modules_dir_name').'/'.$directory.'/'.sfConfig::get('sf_app_module_config_dir_name').'/config_handlers.yml'; |
|---|
| | 317 | |
|---|
| | 318 | require_once($this->checkConfig($configPath)); |
|---|
| | 319 | } |
|---|
| | 320 | } |
|---|
| | 321 | |
|---|
| | 322 | // close file pointer |
|---|
| | 323 | fclose($fp); |
|---|