This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "quickfw".
The branch, master has been updated
via 9f1f2fd43e09892aed409ff398620b0926f6bf1b (commit)
from 0c835bf2b5e45d093c1f7b11586b67bbfc602dc5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9f1f2fd43e09892aed409ff398620b0926f6bf1b
Author: Ivan Borzenkov <iva...@li...>
Date: Wed May 5 14:16:31 2010 +0400
Кеширование разбора MCA
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index a6be5ee..2bbe92d 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -370,9 +370,41 @@ SREG;
protected function loadMCA(&$data, $type)
{
- $MCA = array();
while (isset($data[0]) AND $data[0] === '') array_shift($data);
+ if (!empty(QFW::$config['cache']['MCA']))
+ {
+ $Cache = Cache::get('MCA');
+ $key = 'MCA_'.crc32(serialize($data)).$type.
+ ($type=='Block' ? $this->curModule : $this->defM);
+ $cached = $Cache->load($key);
+ if ($cached)
+ {
+ $MCA = $cached['MCA'];
+ $path = $this->baseDir.'/'.$MCA['Module'];
+ QFW::$view->setScriptPath($path.'/templates');
+ $class = ucfirst($MCA['Controller']).'Controller';
+ $fullname = $path . '/controllers/' . strtr($class,'_','/') . '.php';
+ require_once($fullname);
+ $class_key=$MCA['Module'].'|'.$MCA['Controller'];
+ if ($this->module == '')
+ {
+ $this->cModule = $this->module = $MCA['Module'];
+ $this->cController = $this->controller = $MCA['Controller'];
+ $this->cAction = $this->action = $MCA['Action'];
+ $this->type = $MCA['Type'];
+ }
+ if (!isset($this->classes[$class_key]))
+ $this->classes[$class_key] = array(
+ 'i' => $MCA['Class'] = new $class,
+ 'defA' => $cached['defA'],
+ 'a' => $cached['a'],
+ );
+ return $MCA;
+ }
+ }
+ $MCA = array();
+
//Определяем модуль
if (isset($data[0]) && (is_dir($this->baseDir . '/' . $data[0])))
$MCA['Module'] = array_shift($data);
@@ -475,6 +507,13 @@ SREG;
}
$MCA['Path']=$MCA['Module'].'/'.$MCA['Controller'].'/'.$aname;
+ if (!empty(QFW::$config['cache']['MCA']))
+ $Cache->save(array(
+ 'MCA' => $MCA,
+ 'defA' => $this->classes[$class_key]['defA'],
+ 'a' => $this->classes[$class_key]['a'],
+ ), $key, array());
+
return $MCA;
}
diff --git a/QFW/config.php b/QFW/config.php
index 04bdc89..186f569 100644
--- a/QFW/config.php
+++ b/QFW/config.php
@@ -63,6 +63,11 @@ $config['cache'] = array(
'namespace' => '',
'tags' => false,
),
+ 'MCA' => array(
+ 'module' => 'Xcache',
+ 'namespace' => '',
+ 'tags' => false,
+ ),
);
$config['templater'] = array(
diff --git a/application/default.php b/application/default.php
index 2adf32a..b6f670b 100644
--- a/application/default.php
+++ b/application/default.php
@@ -54,6 +54,11 @@ $config['cache'] = array(
'namespace' => '',
'tags' => false,
),
+ /*'MCA' => array(
+ 'module' => 'Xcache',
+ 'namespace' => '',
+ 'tags' => false,
+ ),*/
);
/**
-----------------------------------------------------------------------
Summary of changes:
QFW/QuickFW/Router.php | 41 ++++++++++++++++++++++++++++++++++++++++-
QFW/config.php | 5 +++++
application/default.php | 5 +++++
3 files changed, 50 insertions(+), 1 deletions(-)
hooks/post-receive
--
quickfw
|