summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-02-13 21:35:26 +0000
committerxue <>2007-02-13 21:35:26 +0000
commite88f17c64dfc13f510e643033c2a0b8177cb0d70 (patch)
tree19d1c1b73f470eee585bce720ecfd5fd5b6a9517
parentbe4ce14eed73ddfba800ff66af3839d779477ee2 (diff)
Performance tuneup.
-rw-r--r--framework/PradoBase.php36
-rw-r--r--framework/TApplication.php6
2 files changed, 16 insertions, 26 deletions
diff --git a/framework/PradoBase.php b/framework/PradoBase.php
index ee0e1602..7c38ce6c 100644
--- a/framework/PradoBase.php
+++ b/framework/PradoBase.php
@@ -271,36 +271,26 @@ class PradoBase
$className=substr($namespace,$pos+1);
if($className==='*') // a directory
{
- if((self::$_application && self::$_application->getMode()===TApplication::STATE_PERFORMANCE) || is_dir($path))
- {
- self::$_usings[$namespace]=$path;
- set_include_path(get_include_path().PATH_SEPARATOR.$path);
- }
- else
- throw new TInvalidDataValueException('prado_using_invalid',$namespace);
+ self::$_usings[$namespace]=$path;
+ set_include_path(get_include_path().PATH_SEPARATOR.$path);
}
else // a file
{
- if((self::$_application && self::$_application->getMode()===TApplication::STATE_PERFORMANCE) || is_file($path))
+ self::$_usings[$namespace]=$path;
+ if(!class_exists($className,false))
{
- self::$_usings[$namespace]=$path;
- if(!class_exists($className,false))
+ try
{
- try
- {
- include_once($path);
- }
- catch(Exception $e)
- {
- if(!class_exists($className,false))
- throw new TInvalidOperationException('prado_component_unknown',$className);
- else
- throw $e;
- }
+ include_once($path);
+ }
+ catch(Exception $e)
+ {
+ if(!class_exists($className,false))
+ throw new TInvalidOperationException('prado_component_unknown',$className);
+ else
+ throw $e;
}
}
- else
- throw new TInvalidDataValueException('prado_using_invalid',$namespace);
}
}
else
diff --git a/framework/TApplication.php b/framework/TApplication.php
index 8101672e..21b00576 100644
--- a/framework/TApplication.php
+++ b/framework/TApplication.php
@@ -324,13 +324,13 @@ class TApplication extends TComponent
// determine configuration path and file
if(empty($basePath) || ($basePath=realpath($basePath))===false)
throw new TConfigurationException('application_basepath_invalid',$basePath);
- if(is_file($basePath))
+ if(is_file($basePath.DIRECTORY_SEPARATOR.self::CONFIG_FILE))
+ $configFile=$basePath.DIRECTORY_SEPARATOR.self::CONFIG_FILE;
+ else if(is_file($basePath))
{
$configFile=$basePath;
$basePath=dirname($configFile);
}
- else if(is_file($basePath.DIRECTORY_SEPARATOR.self::CONFIG_FILE))
- $configFile=$basePath.DIRECTORY_SEPARATOR.self::CONFIG_FILE;
else
$configFile=null;