From e2e0fd64468d8da345767559a3e0ec86e322309e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 13 Oct 2005 12:11:48 +0000 Subject: [PATCH] Make the PHP session restore an own session type in manageheader. So you can switch it on and off, without the need to edit the code. At the moment it's off by default, with a note that it can give a big performance boost (if it works on your distro). Please note: If you already edited your phpgwapi/inc/functions.inc.php to switch it off, you will get an cvs conflict on updating, just do a "cvs update -C phpgwapi/inc/functions.inc.php" to fix it. If you want to use the session restore or you already used it, you need to go to Setup >> Headeradmin and switch it on there. --- login.php | 2 +- logout.php | 2 +- phpgwapi/inc/class.sessions.inc.php | 6 +++--- phpgwapi/inc/functions.inc.php | 6 ++---- setup/check_install.php | 2 +- setup/lang/phpgw_de.lang | 14 +++++++++++--- setup/lang/phpgw_en.lang | 16 ++++++++++++---- setup/manageheader.php | 17 ++++++++++------- 8 files changed, 41 insertions(+), 24 deletions(-) diff --git a/login.php b/login.php index c170730487..483ae4ee8f 100755 --- a/login.php +++ b/login.php @@ -119,7 +119,7 @@ $GLOBALS['egw']->session->phpgw_setcookie('domain'); //fix for bug php4 expired sessions bug - if($GLOBALS['egw_info']['server']['sessions_type'] == 'php4') + if(substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4') { $GLOBALS['egw']->session->phpgw_setcookie(EGW_PHPSESSID); } diff --git a/logout.php b/logout.php index d7c60ba6de..9f0a470498 100755 --- a/logout.php +++ b/logout.php @@ -59,7 +59,7 @@ $GLOBALS['egw']->session->phpgw_setcookie('sessionid'); $GLOBALS['egw']->session->phpgw_setcookie('kp3'); $GLOBALS['egw']->session->phpgw_setcookie('domain'); - if($GLOBALS['egw_info']['server']['sessions_type'] == 'php4') + if(substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4') { $GLOBALS['egw']->session->phpgw_setcookie(EGW_PHPSESSID); } diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index 6e5ffb1513..b5c69f2540 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -1326,7 +1326,7 @@ $GLOBALS['egw_info']['server']['sessions_type'] = 'php4'; // the more performant default } // for php4 sessions, check if the extension is loaded, try loading it and fallback to db sessions if not - if ($GLOBALS['egw_info']['server']['sessions_type'] == 'php4' && !extension_loaded('session')) + if (substr($GLOBALS['egw_info']['server']['sessions_type'],0,4) == 'php4' && !extension_loaded('session')) { // some constanst for pre php4.3 if (!defined('PHP_SHLIB_SUFFIX')) @@ -1339,7 +1339,7 @@ } if (!function_exists('dl') || !@dl(PHP_SHLIB_PREFIX.'session'.'.'.PHP_SHLIB_SUFFIX)) { - $GLOBALS['egw_info']['server']['sessions_type'] = 'db'; // fallback if we have no php4 sessions support + $GLOBALS['egw_info']['server']['sessions_type'] = 'db'; // fallback if we have no php sessions support } } - include_once(EGW_API_INC.'/class.sessions_'.$GLOBALS['egw_info']['server']['sessions_type'].'.inc.php'); + include_once(EGW_API_INC.'/class.sessions_'.substr($GLOBALS['egw_info']['server']['sessions_type'],0,4).'.inc.php'); diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index 4571caeeaa..79a42f44cb 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -45,10 +45,8 @@ echo '!!! PLEASE CORRECT THIS SITUATION !!!

'; } - //define('NO_RESTORE',true); // uncomment to see the difference ;-) - // check if we can restore the eGW enviroment from the php-session - if (!defined('NO_RESTORE') && $GLOBALS['egw_info']['server']['sessions_type'] == 'php4' && $_REQUEST['sessionid'] && + if ($GLOBALS['egw_info']['server']['sessions_type'] == 'php4-restore' && $_REQUEST['sessionid'] && $GLOBALS['egw_info']['flags']['currentapp'] != 'login' && $GLOBALS['egw_info']['flags']['currentapp'] != 'logout') { session_name('sessionid'); @@ -143,7 +141,7 @@ } // saving the the egw_info array and the egw-object in the session - if (!defined('NO_RESTORE') && $GLOBALS['egw_info']['server']['sessions_type'] == 'php4' && $GLOBALS['egw_info']['flags']['currentapp'] != 'login') + if ($GLOBALS['egw_info']['server']['sessions_type'] == 'php4-restore' && $GLOBALS['egw_info']['flags']['currentapp'] != 'login') { $_SESSION['egw_info_cache'] = $GLOBALS['egw_info']; unset($_SESSION['egw_info_cache']['flags']); // dont save the flags, they change on each request diff --git a/setup/check_install.php b/setup/check_install.php index 572919d167..01fde4b347 100644 --- a/setup/check_install.php +++ b/setup/check_install.php @@ -133,7 +133,7 @@ ), 'session' => array( 'func' => 'extension_check', - 'warning' => '
' . lang('The session extension is needed to use php4 session (db-sessions work without).') . "
" + 'warning' => '
' . lang('The session extension is needed to use php sessions (db-sessions work without).') . "
" ), '.' => array( 'func' => 'permission_check', diff --git a/setup/lang/phpgw_de.lang b/setup/lang/phpgw_de.lang index 728e6a72cc..f5257926b6 100644 --- a/setup/lang/phpgw_de.lang +++ b/setup/lang/phpgw_de.lang @@ -26,6 +26,9 @@ all applications setup de Alle Anwendungen all core tables and the admin and preferences applications setup de Sie alle Kern-Tabellen und die Anwendungen Admin und Einstellungen all languages (incl. not listed ones) setup de alle Sprachen (einschl. nicht aufgeführte) all users setup de Alle Benutzer +allow authentication via cookie setup de Erlaube Benutzerauthentifizierung über ein Cookie +allow password migration setup de Erlaube Password Migration +allowed migration types (comma-separated) setup de Erlauber Migrationstypen (Komma separiert) analysis setup de Analyse and reload your webserver, so the above changes take effect !!! setup de UND reloaden Sie ihren Webserver, damit die obigen Änderungen in Kraft treten!!! app details setup de Details der Anwendung @@ -87,7 +90,7 @@ checking file-permissions of %1 for %2 %3: %4 setup de checking for gd support... setup de Überprüfe die GD Unterstützung... checking php.ini setup de Überprüfe die php.ini Datei checking the egroupware installation setup de Überprüfe die eGroupWare-Installation -click here to return to setup. setup de Hier klicken um zum Setup zurück zu kommen. +click here to return to setup. setup de Hier klicken um zu Setup zurück zu kehren. click here setup de Hier klicken click here to re-run the installation tests setup de zum Wiederholen der Installationstests hier klicken completed setup de Abgeschlossen @@ -122,6 +125,7 @@ current system-charset is %1, click %2here%3 to change it. setup de Aktueller Sy current version setup de Gegenwärtige Version currently installed languages: %1
setup de Gegenwärtig installierte Sprachen: %1
database successfully converted from '%1' to '%2' setup de Datenbank erfolgreich von "%1" nach "%2" konvertiert +datebase setup de Datenbank datetime port.
if using port 13, please set firewall rules appropriately before submitting this page.
(port: 13 / host: 129.6.15.28) setup de Port für Datum/Zeitabfragen
Wenn der Port 13 verwendet wird, bitte VOR dem Absenden die Firewallregeln dementsprechend setzen.
(Port 13/Host: 129.6.15.28) day setup de Tag day of week
(0-6, 0=sunday) setup de Wochentag
(0-6, 0=Sonntag) @@ -312,6 +316,8 @@ passwords did not match, please re-enter setup de Passworte stimmten nicht path information setup de Pfadinformationen path to user and group files has to be outside of the webservers document-root!!! setup de Pfad zu Benutzer und Gruppen Dateien MUSS AUSSERHALB des Wurzelverzeichnisses (document root) des Webservers sein!!! persistent connections setup de Permanente Verbindungen +php plus restore setup de PHP plus Wiederherstellen +php plus restore gives by far the best performance, as it stores the egw enviroment completly in the session. setup de PHP plus Wiederherstellen gibt bei weitem die beste Performanze. Es speichert die eGW Umgebung komplett in der Session. please check for sql scripts within the application's directory setup de Bitte suchen Sie ein SQL Skript im Verzeichnis der Anwendung please check read/write permissions on directories, or back up and use another option. setup de Bitte überprüfen Sie die Lese/Schreib-Rechte der Verzeichnisse oder gehen Sie zurück und benutzen eine andere Option. please configure egroupware for your environment setup de Bitte konfigurieren Sie eGroupWare für Ihre Umgebung @@ -418,6 +424,7 @@ the following applications need to be upgraded: setup de Die folgenden Anwendung the imap extension is needed by the two email apps (even if you use email with pop3 as protocoll). setup de Die imap Erweiterung (php extension) wird von den beiden Email Applikationen benötigt (auch wenn Sie das POP3-Protokoll verwenden). the mbstring extension is needed to fully support unicode (utf-8) or other multibyte-charsets. setup de Die mbstring Erweiterung (php extension) ist notwendig um Unicode (utf-8) oder andere mehr-byte (multibyte) Zeichensätze vollständig zu unterstützen. the mbstring.func_overload = 7 is needed to fully support unicode (utf-8) or other multibyte-charsets. setup de Die Einstellung mbstring.func_overload = 7 ist notwendig um Unicode (utf-8) oder andere mehr-byte (multibyte) Zeichensätze vollständig zu unterstützen. +the session extension is needed to use php sessions (db-sessions work without). setup de Die session Erweiterung (php extension) ist notwendig für PHP Sessions (Datenbank Sessions arbeiten ohne diese). the table definition was correct, and the tables were installed setup de Die Tabellen Definition war korrekt und die Tabellen wurden installiert the tables setup de die Tabellen there was a problem trying to connect to your ldap server.
setup de Es gab ein Problem eine Verbindung zu Ihrem LDAP-Server herzustellen.
@@ -441,6 +448,7 @@ translations upgraded setup de true setup de Ja try to configure your php to support one of the above mentioned dbms, or install egroupware by hand. setup de Versuchen Sie Ihr PHP so zu konfigurieren, dass es eine der oben genannten Datenbanken unterstützt, oder installieren Sie eGroupWare von Hand. two weeks setup de zwei Wochen +unfortunally some php/apache packages have problems with it (apache dies and you cant login anymore). setup de Leider haben einige PHP/Apache Packete Probleme damit (Der Apache stirbt und Sie können sich nicht mehr einlogen). uninstall setup de deinstaliert uninstall all applications setup de Alle Anwendungen deinstallieren uninstalled setup de nicht installiert @@ -465,7 +473,7 @@ we can proceed setup de Wir k we will automatically update your tables/records to %1 setup de Wir werden Ihre Tabellen/Einträge automatisch zu %1 aktualisieren we will now run a series of tests, which may take a few minutes. click the link below to proceed. setup de Wir werden jetzt eine Serie von Tests durchführen. Das kann ein paar Minuten dauern. Klicken sie auf den folgenden Link um Fortzufahren. welcome to the egroupware installation setup de Herzlich willkommen zur eGroupWare Installation -what type of sessions management do you want to use (php4 session management may perform better)? setup de Welches Session-Management wollen Sie verwenden (PHP4 Session-Management hat eine bessere Performance)? +what type of sessions management do you want to use (php session management may perform better)? setup de Welches Session-Management wollen Sie verwenden (PHP Session-Management hat eine bessere Performanz)? which database type do you want to use with egroupware? setup de Welchen Datenbanktyp wollen Sie mit eGroupWare verwenden? world readable setup de lesbar von jedem (world readable) world writable setup de schreibbar von jedem (world writeable) @@ -496,7 +504,7 @@ you must enter a username for the admin setup de Sie m you need to add some domains to your header.inc.php. setup de Sie müssen mindestens eine Domain zu Ihrer header.inc.php hinzufügen. you need to select your current charset! setup de Sie müssen Ihren aktuellen Zeichensatz auswählen! you should either uninstall and then reinstall it, or attempt manual repairs setup de Sie sollten entweder de- und neuinstallieren, oder manuelle Reparaturen versuchen -you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup de Sie müssen das entsprechende Schema in Ihren LDAP-Server laden - siehe phpgwapi/doc/ldap/README +you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup de Sie müssen das notwendige phpgwAccounts Schema auf Ihrem LDAP Server installieren - siehe phpgwapi/doc/ldap/README. you're using an old configuration file format... setup de Sie verwenden ein altes Format der Konfigurationsdatei ... you're using an old header.inc.php version... setup de Sie verwenden eine alte header.inc.php Version ... your applications are current setup de Ihre Anwendungen sind aktuell diff --git a/setup/lang/phpgw_en.lang b/setup/lang/phpgw_en.lang index df753e4ffe..fad0bf8e47 100644 --- a/setup/lang/phpgw_en.lang +++ b/setup/lang/phpgw_en.lang @@ -26,6 +26,9 @@ all applications setup en all applications all core tables and the admin and preferences applications setup en all core tables and the admin and preferences applications all languages (incl. not listed ones) setup en all languages (incl. not listed ones) all users setup en All Users +allow authentication via cookie setup en Allow authentication via cookie +allow password migration setup en Allow password migration +allowed migration types (comma-separated) setup en Allowed migration types (comma-separated) analysis setup en Analysis and reload your webserver, so the above changes take effect !!! setup en AND reload your webserver, so the above changes take effect !!! app details setup en App details @@ -87,7 +90,7 @@ checking file-permissions of %1 for %2 %3: %4 setup en Checking file-permissions checking for gd support... setup en Checking for GD support... checking php.ini setup en Checking php.ini checking the egroupware installation setup en Checking the eGroupWare Installation -click here to return to setup. setup en Click here to return to setup. +click here to return to setup. setup en click here to return to setup. click here setup en Click Here click here to re-run the installation tests setup en Click here to re-run the installation tests completed setup en Completed @@ -122,6 +125,7 @@ current system-charset is %1, click %2here%3 to change it. setup en Current syst current version setup en Current Version currently installed languages: %1
setup en Currently installed languages: %1
database successfully converted from '%1' to '%2' setup en Database successfully converted from '%1' to '%2' +datebase setup en Datebase datetime port.
if using port 13, please set firewall rules appropriately before submitting this page.
(port: 13 / host: 129.6.15.28) setup en Datetime port.
If using port 13, please set firewall rules appropriately before submitting this page.
(Port: 13 / Host: 129.6.15.28) day setup en day day of week
(0-6, 0=sunday) setup en day of week
(0-6, 0=sunday) @@ -282,9 +286,9 @@ never setup en never new setup en New next run setup en next run no setup en No +no %1 support found. disabling setup en No %1 support found. Disabling no accounts existing setup en No accounts existing no algorithms available setup en no algorithms available -no %1 support found. disabling setup en No %1 support found. Disabling no modes available setup en no modes available no xml support found. disabling setup en No XML support found. Disabling not setup en not @@ -312,6 +316,8 @@ passwords did not match, please re-enter setup en Passwords did not match, pleas path information setup en Path information path to user and group files has to be outside of the webservers document-root!!! setup en Path to user and group files HAS TO BE OUTSIDE of the webservers document-root!!! persistent connections setup en Persistent connections +php plus restore setup en PHP plus restore +php plus restore gives by far the best performance, as it stores the egw enviroment completly in the session. setup en PHP plus restore gives by far the best performance, as it stores the eGW enviroment completly in the session. please check for sql scripts within the application's directory setup en Please check for sql scripts within the application's directory please check read/write permissions on directories, or back up and use another option. setup en Please check read/write permissions on directories, or back up and use another option. please configure egroupware for your environment setup en Please configure eGroupWare for your environment @@ -418,6 +424,7 @@ the following applications need to be upgraded: setup en The following applicati the imap extension is needed by the two email apps (even if you use email with pop3 as protocoll). setup en The imap extension is needed by the two email apps (even if you use email with pop3 as protocoll). the mbstring extension is needed to fully support unicode (utf-8) or other multibyte-charsets. setup en The mbstring extension is needed to fully support unicode (utf-8) or other multibyte-charsets. the mbstring.func_overload = 7 is needed to fully support unicode (utf-8) or other multibyte-charsets. setup en The mbstring.func_overload = 7 is needed to fully support unicode (utf-8) or other multibyte-charsets. +the session extension is needed to use php sessions (db-sessions work without). setup en The session extension is needed to use php sessions (db-sessions work without). the table definition was correct, and the tables were installed setup en The table definition was correct, and the tables were installed the tables setup en the tables there was a problem trying to connect to your ldap server.
setup en There was a problem trying to connect to your LDAP server.
@@ -441,6 +448,7 @@ translations upgraded setup en Translations Upgraded true setup en True try to configure your php to support one of the above mentioned dbms, or install egroupware by hand. setup en Try to configure your php to support one of the above mentioned DBMS, or install eGroupWare by hand. two weeks setup en two weeks +unfortunally some php/apache packages have problems with it (apache dies and you cant login anymore). setup en Unfortunally some PHP/Apache packages have problems with it (Apache dies and you cant login anymore). uninstall setup en uninstall uninstall all applications setup en Uninstall all applications uninstalled setup en uninstalled @@ -465,7 +473,7 @@ we can proceed setup en We can proceed we will automatically update your tables/records to %1 setup en We will automatically update your tables/records to %1 we will now run a series of tests, which may take a few minutes. click the link below to proceed. setup en We will now run a series of tests, which may take a few minutes. Click the link below to proceed. welcome to the egroupware installation setup en Welcome to the eGroupWare Installation -what type of sessions management do you want to use (php4 session management may perform better)? setup en What type of sessions management do you want to use (PHP4 session management may perform better)? +what type of sessions management do you want to use (php session management may perform better)? setup en What type of sessions management do you want to use (PHP session management may perform better)? which database type do you want to use with egroupware? setup en Which database type do you want to use with eGroupWare? world readable setup en world readable world writable setup en world writable @@ -496,7 +504,7 @@ you must enter a username for the admin setup en You must enter a username for t you need to add some domains to your header.inc.php. setup en You need to add some domains to your header.inc.php. you need to select your current charset! setup en You need to select your current charset! you should either uninstall and then reinstall it, or attempt manual repairs setup en You should either uninstall and then reinstall it, or attempt manual repairs -you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup en You will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/README +you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup en You will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/README you're using an old configuration file format... setup en You're using an old configuration file format... you're using an old header.inc.php version... setup en You're using an old header.inc.php version... your applications are current setup en Your applications are current diff --git a/setup/manageheader.php b/setup/manageheader.php index cd4bb66b8b..4135bb11d3 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -321,9 +321,10 @@ if (check_load_extension('session')) { $detected .= lang('You appear to have PHP session support. Enabling PHP sessions.') . '
' . "\n"; - $supported_sessions_type[] = 'php4'; // makeing php4 sessions the default + $supported_sessions_type['php4'] = 'PHP'; // makeing php sessions the default + $supported_sessions_type['php4-restore'] = lang('PHP plus restore'); // php-sessions with restore of egw_info array and egw object from the session } - $supported_sessions_type[] = 'db'; + $supported_sessions_type['db'] = lang('Datebase'); @reset($default_db_ports); $js_default_db_ports = 'var default_db_ports = new Array();'."\n"; @@ -494,7 +495,7 @@ /* These are a few of the advanced settings */ $GLOBALS['egw_info']['server']['db_persistent'] = True; - $GLOBALS['egw_info']['server']['mcrypt_enabled'] = check_load_extension('mcrypt'); + $GLOBALS['egw_info']['server']['mcrypt_enabled'] = false; // default off, as there are too many problems with buggy mcrypt implementations (was check_load_extension('mcrypt');) $GLOBALS['egw_info']['server']['versions']['mcrypt'] = ''; srand((double)microtime()*1000000); @@ -550,9 +551,9 @@ $selected = ''; $session_options = ''; - while(list($k,$v) = each($supported_sessions_type)) + foreach($supported_sessions_type as $k => $v) { - if($v == @$GLOBALS['egw_info']['server']['sessions_type']) + if($k == @$GLOBALS['egw_info']['server']['sessions_type']) { $selected = ' selected="selected" '; } @@ -560,7 +561,7 @@ { $selected = ''; } - $session_options .= '\n"; + $session_options .= '\n"; } $setup_tpl->set_var('session_options',$session_options); @@ -645,7 +646,9 @@ $setup_tpl->set_var('lang_persist',lang('Persistent connections')); $setup_tpl->set_var('lang_persistdescr',lang('Do you want persistent connections (higher performance, but consumes more resources)')); $setup_tpl->set_var('lang_sesstype',lang('Sessions Type')); - $setup_tpl->set_var('lang_sesstypedescr',lang('What type of sessions management do you want to use (PHP4 session management may perform better)?')); + $setup_tpl->set_var('lang_sesstypedescr',lang('What type of sessions management do you want to use (PHP session management may perform better)?'). + ' '.lang('PHP plus restore gives by far the best performance, as it stores the eGW enviroment completly in the session.'). + ' '.lang('Unfortunally some PHP/Apache packages have problems with it (Apache dies and you cant login anymore).')); $setup_tpl->set_var('lang_enablemcrypt',lang('Enable MCrypt')); $setup_tpl->set_var('lang_mcrypt_warning',lang('Not all mcrypt algorithms and modes work with eGroupWare. If you experience problems try switching it off.')); $setup_tpl->set_var('lang_mcryptversion',lang('MCrypt version'));