Author: shnr17 Date: Tue Aug 11 08:51:49 2009 New Revision: 2521 Log: Sessionverwaltung von e2G auf DB umgestellt, Sessiontabelle geaendert fuer = Zend-Framework, Spaltennamen angepasst Modified: trunk/eStudy2Go/application/bootstrap.php trunk/web/common/classes/class.session.inc.php trunk/web/common/mkf/estudy.sql trunk/web/estudytouch/index.php Modified: trunk/eStudy2Go/application/bootstrap.php =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/eStudy2Go/application/bootstrap.php (original) +++ trunk/eStudy2Go/application/bootstrap.php Tue Aug 11 08:51:49 2009 @@ -70,6 +70,19 @@ // DATABASE TABLE SETUP - Setup the Database Table Adapter Zend_Db_Table_Abstract::setDefaultAdapter($dbAdapter); = +$config =3D array( + 'name' =3D> 'session', + 'primary' =3D> 'id', + 'modifiedColumn' =3D> 'modified', + 'dataColumn' =3D> 'variable', + 'lifetimeColumn' =3D> 'expires' +); + +// Erstellen der Zend_Session_SaveHandler_DbTable und +// Setzen des save Handlers f=C3=83=C2=BCr Zend_Session +Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($config)= ); + + // REGISTRY - setup the application registry $registry =3D Zend_Registry::getInstance(); $registry->configuration =3D $configuration; Modified: trunk/web/common/classes/class.session.inc.php =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/web/common/classes/class.session.inc.php (original) +++ trunk/web/common/classes/class.session.inc.php Tue Aug 11 08:51:49 2009 @@ -96,8 +96,8 @@ public function read($sid) { global $db; = - $query =3D "SELECT session_variable FROM {$this->session_table} " - . "WHERE session_id =3D '{$sid}'"; + $query =3D "SELECT variable FROM {$this->session_table} " + . "WHERE id =3D '{$sid}'"; = return $db->get_var($query); } @@ -112,9 +112,9 @@ global $db; $expiry =3D time() + $this->maxlifetime; = - $sql =3D "INSERT INTO $this->session_table (session_id, session_varia= ble, session_expires) "; + $sql =3D "INSERT INTO $this->session_table (id, variable, expires) "; $sql .=3D " VALUES ('$sid', '$val', '$expiry') "; - $sql .=3D " ON DUPLICATE KEY UPDATE session_variable =3D VALUES(sessi= on_variable), session_expires =3D VALUES(session_expires)"; = + $sql .=3D " ON DUPLICATE KEY UPDATE variable =3D VALUES(variable), ex= pires =3D VALUES(expires)"; = $db->query($sql); = return true; @@ -128,7 +128,7 @@ public function destroy($sid) { global $db; = - $query =3D "DELETE FROM $this->session_table WHERE session_id =3D = '$sid'"; + $query =3D "DELETE FROM $this->session_table WHERE id =3D '$sid'"; $db->query($query); = return true; @@ -144,7 +144,7 @@ = $query =3D "DELETE " . "FROM {$this->session_table} " - . "WHERE session_expires < ".time(); + . "WHERE expires < ".time(); = $db->query($query); return true; Modified: trunk/web/common/mkf/estudy.sql =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/web/common/mkf/estudy.sql (original) +++ trunk/web/common/mkf/estudy.sql Tue Aug 11 08:51:49 2009 @@ -95,10 +95,11 @@ ) TYPE=3DInnoDB COMMENT=3D'Allgemeine Infos, Menue-Leiste oben' DEFAULT CH= ARSET=3Dutf8 COLLATE utf8_unicode_ci; = CREATE TABLE `session` ( -`session_id` varchar(50) collate utf8_unicode_ci NOT NULL, -`session_variable` text collate utf8_unicode_ci NOT NULL, -`session_expires` int(11) NOT NULL, -PRIMARY KEY (`session_id`) +`id` varchar(50) collate utf8_unicode_ci NOT NULL, +`variable` text collate utf8_unicode_ci NOT NULL, +`expires` int(11) NOT NULL, +`modified` int(11), +PRIMARY KEY (`id`) ) ENGINE=3DInnoDB DEFAULT CHARSET=3Dutf8 COLLATE=3Dutf8_unicode_ci; = = = Modified: trunk/web/estudytouch/index.php =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/web/estudytouch/index.php (original) +++ trunk/web/estudytouch/index.php Tue Aug 11 08:51:49 2009 @@ -31,12 +31,6 @@ require_once "Zend/Loader/Autoloader.php"; Zend_Loader_Autoloader::getInstance(); = -// Starte Session -global $settings; -$session_save_path =3D realpath($settings['sessionPath']); -Zend_Session::setOptions(array('save_path' =3D> $session_save_path)); -Zend_Session::start(); - try { require_once APPLICATION_PATH . 'bootstrap.php'; } catch (Exception $exception) { |