[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api class.acl.php, 1.1.1.1.2.1, 1.1.1.1.2.2 class.app
From: |
Dan Kuykendall <address@hidden> |
Subject: |
[Phpgroupware-cvs] api class.acl.php, 1.1.1.1.2.1, 1.1.1.1.2.2 class.apps.php, 1.1.1.1.2.2, 1.1.1.1.2.3 class.phpgw.php, 1.1.1.1.2.19, 1.1.1.1.2.20 class.prefs.php, 1.1.1.1.2.5, 1.1.1.1.2.6 core_functions.inc.php, 1.1.1.1.2.10, 1.1.1.1.2.11 |
Date: |
Mon, 03 Nov 2003 09:20:02 +0000 |
Update of /cvsroot/phpgroupware/api
In directory subversions:/tmp/cvs-serv15504/api
Modified Files:
Tag: proposal-branch
class.acl.php class.apps.php class.phpgw.php class.prefs.php
core_functions.inc.php
Log Message:
added caching of base objects
Index: class.prefs.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.prefs.php,v
retrieving revision 1.1.1.1.2.5
retrieving revision 1.1.1.1.2.6
diff -C2 -d -r1.1.1.1.2.5 -r1.1.1.1.2.6
*** class.prefs.php 1 Nov 2003 19:01:00 -0000 1.1.1.1.2.5
--- class.prefs.php 3 Nov 2003 09:19:59 -0000 1.1.1.1.2.6
***************
*** 46,49 ****
--- 46,59 ----
}
+ function pre_serialize()
+ {
+ // stub so its gets cache'd. No cleanup needed.
+ }
+
+ function post_serialize()
+ {
+ $this->db = $GLOBALS['phpgw']->db;
+ }
+
function set()
{
Index: core_functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/core_functions.inc.php,v
retrieving revision 1.1.1.1.2.10
retrieving revision 1.1.1.1.2.11
diff -C2 -d -r1.1.1.1.2.10 -r1.1.1.1.2.11
*** core_functions.inc.php 1 Nov 2003 17:36:25 -0000 1.1.1.1.2.10
--- core_functions.inc.php 3 Nov 2003 09:19:59 -0000 1.1.1.1.2.11
***************
*** 206,209 ****
--- 206,267 ----
}
+ function saveobject($obj, $var_name = '##NOTSET##')
+ {
+ if(is_object($obj) && method_exists($obj,'pre_serialize'))
+ {
+ /* This would clean up anything it didnt need. */
+ $obj->pre_serialize();
+ if($var_name == '##NOTSET##')
+ {
+ $var_name = get_class($obj);
+ }
+
$GLOBALS['phpgw_session']['serialized_classes'][$var_name] = serialize($obj);
+ }
+ }
+
+ function recoverobject($var_name, $class, $inputs='##NOTSET##', $silent
= False)
+ {
+ $pos = strpos($class,'_');
+ $appname = substr($class,0,$pos);
+ $classname = substr($class,($pos + 1));
+
+ $filename =
PHPGW_ROOT.SEP.$appname.SEP.'class.'.$classname.'.php';
+ if(file_exists($filename))
+ {
+ include_once($filename);
+ if(!class_exists($class))
+ {
+ return createobject($class, $inputs, $silent);
+ }
+ }
+ else
+ {
+ return createobject($class, $inputs, $silent);
+ }
+
+
+
if(isset($GLOBALS['phpgw_session']['serialized_classes'][$var_name]))
+ {
+ $obj =
unserialize($GLOBALS['phpgw_session']['serialized_classes'][$var_name]);
+ if(is_object($obj))
+ {
+ if(method_exists($obj,'post_serialize'))
+ {
+ /* could recreate its db reference and
such */
+ $obj->post_serialize();
+ }
+ return $obj;
+ }
+ else
+ {
+ return createobject($class, $inputs, $silent);
+ }
+ }
+ else
+ {
+ return createobject($class, $inputs, $silent);
+ }
+ }
+
function execmethod($function, $inputs='##NOTSET##', $silent = False)
{
Index: class.apps.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.apps.php,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -C2 -d -r1.1.1.1.2.2 -r1.1.1.1.2.3
*** class.apps.php 26 Oct 2003 06:15:44 -0000 1.1.1.1.2.2
--- class.apps.php 3 Nov 2003 09:19:59 -0000 1.1.1.1.2.3
***************
*** 46,49 ****
--- 46,59 ----
}
+ function pre_serialize()
+ {
+ // stub so its gets cache'd. No cleanup needed.
+ }
+
+ function post_serialize()
+ {
+ $this->db = $GLOBALS['phpgw']->db;
+ }
+
function get_user_apps()
{
Index: class.acl.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.acl.php,v
retrieving revision 1.1.1.1.2.1
retrieving revision 1.1.1.1.2.2
diff -C2 -d -r1.1.1.1.2.1 -r1.1.1.1.2.2
*** class.acl.php 31 Oct 2003 08:42:33 -0000 1.1.1.1.2.1
--- class.acl.php 3 Nov 2003 09:19:59 -0000 1.1.1.1.2.2
***************
*** 79,83 ****
--- 79,93 ----
$this->acl_isop = $args['acl_isop'];
}
+
+ function pre_serialize()
+ {
+ // stub so its gets cache'd. No cleanup needed.
+ }
+ function post_serialize()
+ {
+ $this->db = $GLOBALS['phpgw']->db;
+ }
+
function get_memberships ()
{
Index: class.phpgw.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.phpgw.php,v
retrieving revision 1.1.1.1.2.19
retrieving revision 1.1.1.1.2.20
diff -C2 -d -r1.1.1.1.2.19 -r1.1.1.1.2.20
*** class.phpgw.php 1 Nov 2003 19:01:00 -0000 1.1.1.1.2.19
--- class.phpgw.php 3 Nov 2003 09:19:59 -0000 1.1.1.1.2.20
***************
*** 114,127 ****
/* and also have them send their appropriate
data to phpgw_data */
$GLOBALS['performance_timer']->start('api_account');
! $this->accounts =
createobject('api_accounts',$GLOBALS['phpgw_session']['session_lid']);
$this->accounts->fill_phpgw_data();
$GLOBALS['performance_timer']->stop('api_account');
$GLOBALS['performance_timer']->start('api_acl');
! $this->acl = createobject('api_acl');
$GLOBALS['performance_timer']->stop('api_acl');
$GLOBALS['performance_timer']->start('api_pref');
! $this->prefs = createobject('api_prefs');
$this->prefs->fill_phpgw_data();
$GLOBALS['performance_timer']->stop('api_pref');
--- 114,130 ----
/* and also have them send their appropriate
data to phpgw_data */
$GLOBALS['performance_timer']->start('api_account');
! $this->accounts = recoverobject('accounts',
'api_accounts', $GLOBALS['phpgw_session']['session_lid']);
! //$this->accounts =
createobject('api_accounts',$GLOBALS['phpgw_session']['session_lid']);
$this->accounts->fill_phpgw_data();
$GLOBALS['performance_timer']->stop('api_account');
$GLOBALS['performance_timer']->start('api_acl');
! $this->acl = recoverobject('acl', 'api_acl');
! //$this->acl = createobject('api_acl');
$GLOBALS['performance_timer']->stop('api_acl');
$GLOBALS['performance_timer']->start('api_pref');
! $this->prefs = recoverobject('prefs',
'api_prefs');
! //$this->prefs = createobject('api_prefs');
$this->prefs->fill_phpgw_data();
$GLOBALS['performance_timer']->stop('api_pref');
***************
*** 130,133 ****
--- 133,137 ----
//$GLOBALS['phpgw_data']['prefs']['api.lang'] = 'es';
$GLOBALS['performance_timer']->start('api_lang');
+ //$this->lang = recoverobject('lang',
'api_lang');
$this->lang = createobject('api_lang');
$this->lang->switchlang();
***************
*** 135,139 ****
$GLOBALS['performance_timer']->start('api_apps');
! $this->apps = createobject('api_apps');
$this->apps->fill_phpgw_data();
$GLOBALS['performance_timer']->stop('api_apps');
--- 139,144 ----
$GLOBALS['performance_timer']->start('api_apps');
! $this->apps = recoverobject('apps', 'api_apps');
! //$this->apps = createobject('api_apps');
$this->apps->fill_phpgw_data();
$GLOBALS['performance_timer']->stop('api_apps');
***************
*** 350,355 ****
$this->base_xml->add_node($GLOBALS['phpgw_xmldoc']);
! /* Now pass back to the RPC for final packaging. */
$this->interface->sendtoclient();
$GLOBALS['performance_timer']->stop('phpgw');
$GLOBALS['performance_timer']->save();
--- 355,373 ----
$this->base_xml->add_node($GLOBALS['phpgw_xmldoc']);
! /* Pack up any classes that want to be serialized */
! $GLOBALS['performance_timer']->start('cache_classes');
! $myvars = get_object_vars($this);
! foreach($myvars as $key=>$val)
! {
! saveobject($val, $key);
! }
! $GLOBALS['performance_timer']->stop('cache_classes');
!
! /* Before we send output, save the session data */
! $GLOBALS['phpgw']->session->save_data();
!
! /* Now pass back to the interface for final packaging.
*/
$this->interface->sendtoclient();
+
$GLOBALS['performance_timer']->stop('phpgw');
$GLOBALS['performance_timer']->save();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api class.acl.php, 1.1.1.1.2.1, 1.1.1.1.2.2 class.apps.php, 1.1.1.1.2.2, 1.1.1.1.2.3 class.phpgw.php, 1.1.1.1.2.19, 1.1.1.1.2.20 class.prefs.php, 1.1.1.1.2.5, 1.1.1.1.2.6 core_functions.inc.php, 1.1.1.1.2.10, 1.1.1.1.2.11,
Dan Kuykendall <address@hidden> <=