added to cache getDefaultMid

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9185 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
dragan-dan 2011-09-16 15:47:50 +00:00
parent 5fcb4ce820
commit 77a186161e
2 changed files with 73 additions and 50 deletions

View file

@ -248,6 +248,19 @@
}
$output = executeQuery('module.updateSite', $args);
//clear cache for default mid
if($args->site_srl == 0) $vid='';
else $vid=$args->domain;
$mid = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl)->mid;
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport()){
if($args->site_srl == 0){
$cache_key = 'object_default_mid:_';
$oCacheHandler->delete($cache_key);
}
$cache_key = 'object_default_mid:'.$vid.'_'.$mid;
$oCacheHandler->delete($cache_key);
}
return $output;
}

View file

@ -72,6 +72,12 @@
$request_url = preg_replace('/\/$/','',Context::getRequestUri());
$vid = Context::get('vid');
$mid = Context::get('mid');
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport()){
$cache_key = 'object_default_mid:'.$vid.'_'.$mid;
$output = $oCacheHandler->get($cache_key);
}
if(!$output){
// Check a virtual site if the default URL is already set and is is defferent from a requested URL
if($default_url && $default_url != $request_url) {
$url_info = parse_url($request_url);
@ -79,6 +85,7 @@
$path = preg_replace('/\/$/','',$url_info['path']);
$sites_args->domain = sprintf('%s%s%s', $hostname, $url_info['port']&&$url_info['port']!=80?':'.$url_info['port']:'',$path);
$output = executeQuery('module.getSiteInfoByDomain', $sites_args);
if($oCacheHandler->isSupport() && $output->data) $oCacheHandler->put($cache_key,$output);
}
if(!$output || !$output->data)
{
@ -90,6 +97,7 @@
Context::set('vid', $output->data->domain, true);
if($mid==$output->data->domain) Context::set('mid',$output->data->mid,true);
}
if($oCacheHandler->isSupport() && $output->data) $oCacheHandler->put($cache_key,$output);
}
}
// If it is not a virtual site, get a default site information
@ -120,6 +128,8 @@
if(!$output->toBool()) return $output;
}
$output = executeQuery('module.getSiteInfo', $args);
}
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
}
}
$module_info = $output->data;