From 632da1c5f8056bcf8bc45cc629b0fa36d4139b5c Mon Sep 17 00:00:00 2001 From: ngleader Date: Mon, 17 May 2010 06:01:08 +0000 Subject: [PATCH] =?UTF-8?q?=EC=84=A4=EC=B9=98=EC=8B=9C=20optimized=20scrip?= =?UTF-8?q?t.php=20=EC=98=A4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7461 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/cache/CacheHandler.class.php | 35 ++++++++++++++-------------- common/script.php | 19 +++++++++++---- 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/classes/cache/CacheHandler.class.php b/classes/cache/CacheHandler.class.php index 03dcc66aa..34f108906 100644 --- a/classes/cache/CacheHandler.class.php +++ b/classes/cache/CacheHandler.class.php @@ -17,25 +17,26 @@ function CacheHandler($target, $info=null) { if(!$info) $info = Context::getDBInfo(); - - if($target == 'object'){ - if($info->use_template_cache =='apc') $type = 'apc'; - else if(substr($info->use_template_cache,0,8)=='memcache'){ - $type = 'memcache'; - $url = $info->use_template_cache; + if($info){ + if($target == 'object'){ + if($info->use_template_cache =='apc') $type = 'apc'; + else if(substr($info->use_template_cache,0,8)=='memcache'){ + $type = 'memcache'; + $url = $info->use_template_cache; + } + }else if($target == 'template'){ + if($info->use_template_cache =='apc') $type = 'apc'; + else if(substr($info->use_template_cache,0,8)=='memcache'){ + $type = 'memcache'; + $url = $info->use_template_cache; + } } - }else if($target == 'template'){ - if($info->use_template_cache =='apc') $type = 'apc'; - else if(substr($info->use_template_cache,0,8)=='memcache'){ - $type = 'memcache'; - $url = $info->use_template_cache; - } - } - if($type){ - $class = 'Cache' . ucfirst($type); - include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class); - $this->handler = call_user_func(array($class,'getInstance'), $url); + if($type){ + $class = 'Cache' . ucfirst($type); + include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class); + $this->handler = call_user_func(array($class,'getInstance'), $url); + } } } diff --git a/common/script.php b/common/script.php index 4b724cc27..90f131035 100644 --- a/common/script.php +++ b/common/script.php @@ -13,12 +13,21 @@ define('_XE_PATH_', $XE_PATH); define('__ZBXE__', true); define('__XE_LOADED_CLASS__', true); include _XE_PATH_ . 'config/config.inc.php'; -include _XE_PATH_ . 'files/config/db.config.php'; -include _XE_PATH_ . 'classes/handler/Handler.class.php'; -include _XE_PATH_ . 'classes/cache/CacheHandler.class.php'; -$oCacheHandler = new CacheHandler('template', $db_info); -$cache_support = $oCacheHandler->isSupport(); +$dbconfig_file =_XE_PATH_ . 'files/config/db.config.php'; +if(file_exists($dbconfig_file)){ + include $dbconfig_file; + if($db_info && $db_info->use_template_cache){ + include _XE_PATH_ . 'classes/handler/Handler.class.php'; + include _XE_PATH_ . 'classes/cache/CacheHandler.class.php'; + $oCacheHandler = new CacheHandler('template', $db_info); + $cache_support = $oCacheHandler->isSupport(); + }else{ + $cache_support = false; + } +}else{ + $cache_support = false; +} $XE_WEB_PATH = substr($XE_PATH,strlen($_SERVER['DOCUMENT_ROOT'])); if(substr($XE_WEB_PATH,-1) != "/") $XE_WEB_PATH .= "/";