phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc functions.inc.php,1.120,1.121 class


From: Mark A Peters <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc functions.inc.php,1.120,1.121 class.sessions_db.inc.php,1.1,1.2 class.sessions_php4.inc.php,1.5,1.6
Date: Sat, 12 Jan 2002 23:06:43 -0500

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv15316/phpgwapi/inc

Modified Files:
        functions.inc.php class.sessions_db.inc.php 
        class.sessions_php4.inc.php 
Log Message:
Trying to get a speed increase out of the cache.

Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/functions.inc.php,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -r1.120 -r1.121
*** functions.inc.php   10 Jan 2002 18:18:44 -0000      1.120
--- functions.inc.php   13 Jan 2002 04:06:40 -0000      1.121
***************
*** 651,671 ****
                }
  
-               if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) && 
!$HTTPS)
-               {
-                       Header('Location: https://' . 
$GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw_info']['server']['webserver_url'] . $REQUEST_URI);
-               }
- 
                if(@isset($GLOBALS['phpgw_info']['server']['cache_phpgw_info']))
                {
                        if($server_info_cache)
                        {
!                               $cache_query = "UPDATE phpgw_app_sessions set 
content='".addslashes(serialize($GLOBALS['phpgw_info']['server']))."'"
!                                       ." WHERE sessionid = '0' and loginid = 
'0' and app = 'phpgwapi' and location = 'config'";
!                       }
!                       else
!                       {
!                               $cache_query = 'INSERT INTO 
phpgw_app_sessions(sessionid,loginid,app,location,content) VALUES('
!                                       . 
"'0','0','phpgwapi','config','".addslashes(serialize($GLOBALS['phpgw_info']['server']))."')";
                        }
                        
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
                }
--- 651,663 ----
                }
  
                if(@isset($GLOBALS['phpgw_info']['server']['cache_phpgw_info']))
                {
                        if($server_info_cache)
                        {
!                               $cache_query = "DELETE FROM phpgw_app_sessions 
WHERE sessionid='0' and loginid='0' and app='phpgwapi' and location='config'";
!                               
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);                   
        
                        }
+                       $cache_query = 'INSERT INTO 
phpgw_app_sessions(sessionid,loginid,app,location,content) VALUES('
+                               . 
"'0','0','phpgwapi','config','".addslashes(serialize($GLOBALS['phpgw_info']['server']))."')";
                        
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
                }
***************
*** 673,676 ****
--- 665,674 ----
        unset($cache_query);
        unset($server_info_cache);
+       if(@isset($GLOBALS['phpgw_info']['server']['enforce_ssl']) && !$HTTPS)
+       {
+               Header('Location: https://' . 
$GLOBALS['phpgw_info']['server']['hostname'] . 
$GLOBALS['phpgw_info']['server']['webserver_url'] . $REQUEST_URI);
+               exit;
+       }
+ 
        
/************************************************************************\
        * Required classes                                                      
 *

Index: class.sessions_db.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.sessions_db.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.sessions_db.inc.php   2 Jan 2002 14:32:08 -0000       1.1
--- class.sessions_db.inc.php   13 Jan 2002 04:06:40 -0000      1.2
***************
*** 164,168 ****
--- 164,174 ----
                        $GLOBALS['phpgw_info']['user']['account_id'] = 
$this->account_id;
  
+                       /* init the crypto object before appsession call below 
*/
+                       $this->key = md5($this->kp3 . $this->sessionid . 
$GLOBALS['phpgw_info']['server']['encryptkey']);
+                       $this->iv  = 
$GLOBALS['phpgw_info']['server']['mcrypt_iv'];
+                       
$GLOBALS['phpgw']->crypto->init(array($this->key,$this->iv));
+ 
                        
$this->read_repositories(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info']);
+                       
                        if ($this->user['expires'] != -1 && 
$this->user['expires'] < time())
                        {
***************
*** 177,188 ****
                                        $GLOBALS['phpgw']->log->commit();
                                }
                                return False;
                        }
  
-                       /* init the crypto object before appsession call below 
*/
-                       $this->key = md5($this->kp3 . $this->sessionid . 
$GLOBALS['phpgw_info']['server']['encryptkey']);
-                       $this->iv  = 
$GLOBALS['phpgw_info']['server']['mcrypt_iv'];
-                       
$GLOBALS['phpgw']->crypto->init(array($this->key,$this->iv));
- 
                        $GLOBALS['phpgw_info']['user']  = $this->user;
                        $GLOBALS['phpgw_info']['hooks'] = $this->hooks;
--- 183,194 ----
                                        $GLOBALS['phpgw']->log->commit();
                                }
+                               if(is_object($GLOBALS['phpgw']->crypto))
+                               {
+                                       $GLOBALS['phpgw']->crypto->cleanup();
+                                       unset($GLOBALS['phpgw']->crypto);
+                               }
                                return False;
                        }
  
                        $GLOBALS['phpgw_info']['user']  = $this->user;
                        $GLOBALS['phpgw_info']['hooks'] = $this->hooks;
***************
*** 204,208 ****
                                        $GLOBALS['phpgw']->log->commit();
                                }
- 
                                if(is_object($GLOBALS['phpgw']->crypto))
                                {
--- 210,213 ----
***************
*** 229,233 ****
                                                
$GLOBALS['phpgw']->log->commit();
                                        }
- 
                                        if(is_object($GLOBALS['phpgw']->crypto))
                                        {
--- 234,237 ----
***************
*** 256,260 ****
                                        $GLOBALS['phpgw']->log->commit();
                                }
- 
                                if(is_object($GLOBALS['phpgw']->crypto))
                                {
--- 260,263 ----
***************
*** 262,265 ****
--- 265,269 ----
                                        unset($GLOBALS['phpgw']->crypto);
                                }
+                               echo 'DEBUG: Sessions: account_id is 
empty!<br>'."\n";
                                return False;
                        }
***************
*** 356,359 ****
--- 360,368 ----
                        }
  
+                       /* init the crypto object */
+                       $this->key = md5($this->kp3 . $this->sessionid . 
$GLOBALS['phpgw_info']['server']['encryptkey']);
+                       $this->iv  = 
$GLOBALS['phpgw_info']['server']['mcrypt_iv'];
+                       
$GLOBALS['phpgw']->crypto->init(array($this->key,$this->iv));
+ 
                        $this->read_repositories(False);
                        if ($this->user['expires'] != -1 && 
$this->user['expires'] < time())
***************
*** 373,381 ****
                        }
  
-                       /* init the crypto object */
-                       $this->key = md5($this->kp3 . $this->sessionid . 
$GLOBALS['phpgw_info']['server']['encryptkey']);
-                       $this->iv  = 
$GLOBALS['phpgw_info']['server']['mcrypt_iv'];
-                       
$GLOBALS['phpgw']->crypto->init(array($this->key,$this->iv));
- 
                        $GLOBALS['phpgw_info']['user']  = $this->user;
                        $GLOBALS['phpgw_info']['hooks'] = $this->hooks;
--- 382,385 ----
***************
*** 667,671 ****
                * Functions for appsession data and session cache               
          *
                
\*************************************************************************/
!               function read_repositories($cached='')
                {
                        $GLOBALS['phpgw']->acl->acl($this->account_id);
--- 671,675 ----
                * Functions for appsession data and session cache               
          *
                
\*************************************************************************/
!               function read_repositories($cached='',$write_cache=True)
                {
                        $GLOBALS['phpgw']->acl->acl($this->account_id);
***************
*** 687,701 ****
                                else
                                {
!                                       $this->setup_cache();
                                }
                        }
                        else
                        {
!                               $this->setup_cache();
                        }
                        $this->hooks = $GLOBALS['phpgw']->hooks->read();
                }
  
!               function setup_cache()
                {
                        $this->user                = 
$GLOBALS['phpgw']->accounts->read_repository();
--- 691,705 ----
                                else
                                {
!                                       $this->setup_cache($write_cache);
                                }
                        }
                        else
                        {
!                               $this->setup_cache($write_cache);
                        }
                        $this->hooks = $GLOBALS['phpgw']->hooks->read();
                }
  
!               function setup_cache($write_cache=True)
                {
                        $this->user                = 
$GLOBALS['phpgw']->accounts->read_repository();
***************
*** 714,719 ****
                        $this->user['userid']      = $this->account_lid;
                        $this->user['passwd']      = @$this->passwd;
!                       
if(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info'])
                        {
                                
$this->appsession('phpgw_info_cache','phpgwapi',$this->user);
                        }
--- 718,724 ----
                        $this->user['userid']      = $this->account_lid;
                        $this->user['passwd']      = @$this->passwd;
!                       
if(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $write_cache)
                        {
+                               $this->delete_cache();
                                
$this->appsession('phpgw_info_cache','phpgwapi',$this->user);
                        }
***************
*** 729,733 ****
                        $GLOBALS['phpgw']->db->query($query);
                }
!       
                function save_repositories()
                {
--- 734,743 ----
                        $GLOBALS['phpgw']->db->query($query);
                }
! 
! // This looks to be useless
! // This will capture everything in the $GLOBALS['phpgw_info'] including 
server info,
! // and store it in appsessions.  This is really incompatible with any type of 
restoring
! // from appsession as the saved user info is really in ['user'] rather than 
the root of
! // the structure, which is what this class likes.
                function save_repositories()
                {
***************
*** 772,776 ****
                                {
                                        $data = 
$GLOBALS['phpgw']->crypto->decrypt($data);
!                                       //echo 'appsession returning: '; 
_debug_array($data);
                                        return $data;
                                }
--- 782,786 ----
                                {
                                        $data = 
$GLOBALS['phpgw']->crypto->decrypt($data);
! //                                    echo 'appsession returning: '; 
_debug_array($data);
                                        return $data;
                                }

Index: class.sessions_php4.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.sessions_php4.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.sessions_php4.inc.php 2 Jan 2002 20:50:28 -0000       1.5
--- class.sessions_php4.inc.php 13 Jan 2002 04:06:40 -0000      1.6
***************
*** 158,161 ****
--- 158,166 ----
                        $GLOBALS['phpgw_info']['user']['account_id'] = 
$this->account_id;
  
+                       /* init the crypto object before appsession call below 
*/
+                       $this->key = md5($this->kp3 . $this->sessionid . 
$GLOBALS['phpgw_info']['server']['encryptkey']);
+                       $this->iv  = 
$GLOBALS['phpgw_info']['server']['mcrypt_iv'];
+                       
$GLOBALS['phpgw']->crypto->init(array($this->key,$this->iv));
+ 
                        
$this->read_repositories(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info']);
                        if ($this->user['expires'] != -1 && 
$this->user['expires'] < time())
***************
*** 171,182 ****
                                        $GLOBALS['phpgw']->log->commit();
                                }
                                return False;
                        }
  
-                       /* init the crypto object before appsession call below 
*/
-                       $this->key = md5($this->kp3 . $this->sessionid . 
$GLOBALS['phpgw_info']['server']['encryptkey']);
-                       $this->iv  = 
$GLOBALS['phpgw_info']['server']['mcrypt_iv'];
-                       
$GLOBALS['phpgw']->crypto->init(array($this->key,$this->iv));
- 
                        $GLOBALS['phpgw_info']['user']  = $this->user;
                        $GLOBALS['phpgw_info']['hooks'] = $this->hooks;
--- 176,187 ----
                                        $GLOBALS['phpgw']->log->commit();
                                }
+                               if(is_object($GLOBALS['phpgw']->crypto))
+                               {
+                                       $GLOBALS['phpgw']->crypto->cleanup();
+                                       unset($GLOBALS['phpgw']->crypto);
+                               }
                                return False;
                        }
  
                        $GLOBALS['phpgw_info']['user']  = $this->user;
                        $GLOBALS['phpgw_info']['hooks'] = $this->hooks;
***************
*** 198,202 ****
                                        $GLOBALS['phpgw']->log->commit();
                                }
- 
                                if(is_object($GLOBALS['phpgw']->crypto))
                                {
--- 203,206 ----
***************
*** 223,227 ****
                                                
$GLOBALS['phpgw']->log->commit();
                                        }
- 
                                        if(is_object($GLOBALS['phpgw']->crypto))
                                        {
--- 227,230 ----
***************
*** 250,254 ****
                                        $GLOBALS['phpgw']->log->commit();
                                }
- 
                                if(is_object($GLOBALS['phpgw']->crypto))
                                {
--- 253,256 ----
***************
*** 661,665 ****
                * Functions for appsession data and session cache               
          *
                
\*************************************************************************/
!               function read_repositories($cached='')
                {
                        $GLOBALS['phpgw']->acl->acl($this->account_id);
--- 663,667 ----
                * Functions for appsession data and session cache               
          *
                
\*************************************************************************/
!               function read_repositories($cached='',$write_cache=True)
                {
                        $GLOBALS['phpgw']->acl->acl($this->account_id);
***************
*** 691,695 ****
                }
  
!               function setup_cache()
                {
                        $this->user                = 
$GLOBALS['phpgw']->accounts->read_repository();
--- 693,697 ----
                }
  
!               function setup_cache($write_cache=True)
                {
                        $this->user                = 
$GLOBALS['phpgw']->accounts->read_repository();
***************
*** 708,713 ****
                        $this->user['userid']      = $this->account_lid;
                        $this->user['passwd']      = @$this->passwd;
!                       
if(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info'])
                        {
                                
$this->appsession('phpgw_info_cache','phpgwapi',$this->user);
                        }
--- 710,716 ----
                        $this->user['userid']      = $this->account_lid;
                        $this->user['passwd']      = @$this->passwd;
!                       
if(@$GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $write_cache)
                        {
+                               $this->delete_cache();
                                
$this->appsession('phpgw_info_cache','phpgwapi',$this->user);
                        }
***************
*** 723,727 ****
                        $GLOBALS['HTTP_SESSION_VARS']['phpgw_session'] = 
$GLOBALS['phpgw_session'];
                }
!       
                function save_repositories()
                {
--- 726,735 ----
                        $GLOBALS['HTTP_SESSION_VARS']['phpgw_session'] = 
$GLOBALS['phpgw_session'];
                }
! 
! // This looks to be useless
! // This will capture everything in the $GLOBALS['phpgw_info'] including 
server info,
! // and store it in appsessions.  This is really incompatible with any type of 
restoring
! // from appsession as the saved user info is really in ['user'] rather than 
the root of
! // the structure, which is what this class likes.
                function save_repositories()
                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]