import v1.1.0_RC2 | 2009-09-20
This commit is contained in:
@ -15,9 +15,9 @@
|
||||
* @category Zend
|
||||
* @package Zend_Application
|
||||
* @subpackage Resource
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Modules.php 16156 2009-06-19 04:09:36Z norm2782 $
|
||||
* @version $Id: Modules.php 17730 2009-08-21 19:50:07Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -26,7 +26,7 @@
|
||||
* @category Zend
|
||||
* @package Zend_Application
|
||||
* @subpackage Resource
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Application_Resource_Modules extends Zend_Application_Resource_ResourceAbstract
|
||||
@ -62,24 +62,41 @@ class Zend_Application_Resource_Modules extends Zend_Application_Resource_Resour
|
||||
|
||||
$modules = $front->getControllerDirectory();
|
||||
$default = $front->getDefaultModule();
|
||||
foreach (array_keys($modules) as $module) {
|
||||
if ($module === $default) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$curBootstrapClass = get_class($bootstrap);
|
||||
foreach ($modules as $module => $moduleDirectory) {
|
||||
$bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap';
|
||||
if (!class_exists($bootstrapClass, false)) {
|
||||
$bootstrapPath = $front->getModuleDirectory($module) . '/Bootstrap.php';
|
||||
$bootstrapPath = dirname($moduleDirectory) . '/Bootstrap.php';
|
||||
if (file_exists($bootstrapPath)) {
|
||||
$eMsgTpl = 'Bootstrap file found for module "%s" but bootstrap class "%s" not found';
|
||||
include_once $bootstrapPath;
|
||||
if (!class_exists($bootstrapClass, false)) {
|
||||
throw new Zend_Application_Resource_Exception('Bootstrap file found for module "' . $module . '" but bootstrap class "' . $bootstrapClass . '" not found');
|
||||
if (($default != $module)
|
||||
&& !class_exists($bootstrapClass, false)
|
||||
) {
|
||||
throw new Zend_Application_Resource_Exception(sprintf(
|
||||
$eMsgTpl, $module, $bootstrapClass
|
||||
));
|
||||
} elseif ($default == $module) {
|
||||
if (!class_exists($bootstrapClass, false)) {
|
||||
$bootstrapClass = 'Bootstrap';
|
||||
if (!class_exists($bootstrapClass, false)) {
|
||||
throw new Zend_Application_Resource_Exception(sprintf(
|
||||
$eMsgTpl, $module, $bootstrapClass
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($bootstrapClass == $curBootstrapClass) {
|
||||
// If the found bootstrap class matches the one calling this
|
||||
// resource, don't re-execute.
|
||||
continue;
|
||||
}
|
||||
|
||||
$moduleBootstrap = new $bootstrapClass($bootstrap);
|
||||
$moduleBootstrap->bootstrap();
|
||||
$this->_bootstraps[$module] = $moduleBootstrap;
|
||||
|
Reference in New Issue
Block a user