[Cs-webapplibs-commits] SF.net SVN: cs-webapplibs:[130] trunk/0.3
Status: Beta
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-08-21 16:16:31
|
Revision: 130 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=130&view=rev Author: crazedsanity Date: 2009-08-21 16:16:22 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Fix/consolidate schema, logging. /setup/db_session_schema.*.sql: * consolidated with main schema files. /schema.mysql.sql: * changed all tables to run on InnoDB. * add cswal_session_store_table (for cs_sessionDB) /schema.pgsql.sql: * add cswal_session_store_table (for cs_sessionDB) /cs_sessionDB.class.php: * __construct(): -- fix table name & sequence to use "cswal" prefix. -- create instance of cs_webdblogger (which will automatically cause any upgrades to cs-webapplibs to run). -- remove note about session_id() -- remove the "audit_logging" setting. * do_log(): -- clone internal db handle & call reconnect() to establish a new connection to the database. Modified Paths: -------------- trunk/0.3/cs_sessionDB.class.php trunk/0.3/setup/schema.mysql.sql trunk/0.3/setup/schema.pgsql.sql Removed Paths: ------------- trunk/0.3/setup/db_session_schema.mysql.sql trunk/0.3/setup/db_session_schema.pgsql.sql Modified: trunk/0.3/cs_sessionDB.class.php =================================================================== --- trunk/0.3/cs_sessionDB.class.php 2009-08-21 14:47:11 UTC (rev 129) +++ trunk/0.3/cs_sessionDB.class.php 2009-08-21 16:16:22 UTC (rev 130) @@ -47,13 +47,12 @@ $this->db = new cs_phpDB(constant('DBTYPE')); $this->db->connect($dbParams); - $this->tableName = 'cs_session_store_table'; + $this->tableName = 'cswal_session_store_table'; $this->tablePKey = 'session_store_id'; - $this->sequenceName = 'cs_session_store_table_session_store_id_seq'; + $this->sequenceName = 'cswal_session_store_table_session_store_id_seq'; - if(!$this->sessdb_table_exists()) { - $this->load_table(); - } + //create a logger (this will automatically cause any upgrades to happen). + $this->logger = new cs_webdblogger($this->db, 'Session DB', true); //now tell PHP to use this class's methods for saving the session. session_set_save_handler( @@ -65,17 +64,9 @@ array(&$this, 'sessdb_gc') ); - //NOTE::: calling session_id() here, prior to parent's construct, can set a specific session_id; if - // something like cs_authToken (part of cs-webapplibs project) were used, just call - // cs_authToken::create_token() here... parent::__construct(true); - //Stop things from going into an audit log... see - //http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711/page3.html - // NOTE::: not sure if this is valid or not... - $this->audit_logging = false; - }//end __construct() //------------------------------------------------------------------------- @@ -338,8 +329,8 @@ //check if the logger object has been created. if(!is_object($this->logger)) { - $newDB = new cs_phpDB(constant('DBTYPE')); - $newDB->connect($this->db->connectParams, true); + $newDB = clone $this->db; + $newDB->reconnect(true); $this->logger = new cs_webdblogger($newDB, $this->logCategory); } Deleted: trunk/0.3/setup/db_session_schema.mysql.sql =================================================================== --- trunk/0.3/setup/db_session_schema.mysql.sql 2009-08-21 14:47:11 UTC (rev 129) +++ trunk/0.3/setup/db_session_schema.mysql.sql 2009-08-21 16:16:22 UTC (rev 130) @@ -1,17 +0,0 @@ - - --- --- Store session data in here. --- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711 --- - -CREATE TABLE `cswal_session_store_table` ( - `session_store_id` int NOT NULL AUTO_INCREMENT, - `session_id` varchar(32) NOT NULL, - `user_id` varchar(16) NOT NULL, - `date_created` datetime NOT NULL, - `last_updated` datetime NOT NULL, - `session_data` LONGTEXT NOT NULL, - PRIMARY KEY (`session_store_id`) -) -ENGINE = InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; \ No newline at end of file Deleted: trunk/0.3/setup/db_session_schema.pgsql.sql =================================================================== --- trunk/0.3/setup/db_session_schema.pgsql.sql 2009-08-21 14:47:11 UTC (rev 129) +++ trunk/0.3/setup/db_session_schema.pgsql.sql 2009-08-21 16:16:22 UTC (rev 130) @@ -1,16 +0,0 @@ - - --- --- Store session data in here. --- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711 --- - -CREATE TABLE cswal_session_store_table ( - session_store_id serial NOT NULL PRIMARY KEY, - session_id varchar(32) NOT NULL DEFAULT '' UNIQUE, - user_id varchar(16), - date_created timestamp NOT NULL DEFAULT NOW(), - last_updated timestamp NOT NULL DEFAULT NOW(), - session_data text -); - Modified: trunk/0.3/setup/schema.mysql.sql =================================================================== --- trunk/0.3/setup/schema.mysql.sql 2009-08-21 14:47:11 UTC (rev 129) +++ trunk/0.3/setup/schema.mysql.sql 2009-08-21 16:16:22 UTC (rev 130) @@ -146,7 +146,7 @@ version_id int NOT NULL PRIMARY KEY, project_name varchar(30) NOT NULL UNIQUE, version_string varchar(50) NOT NULL -); +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE cswal_auth_token_table ( auth_token_id serial NOT NULL PRIMARY KEY, @@ -158,4 +158,21 @@ creation timestamp NOT NULL DEFAULT NOW(), last_updated timestamp, expiration timestamp NOT NULL -); \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + + + +-- +-- Store session data in here. +-- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711 +-- + +CREATE TABLE `cswal_session_store_table` ( + `session_store_id` int NOT NULL AUTO_INCREMENT, + `session_id` varchar(32) NOT NULL, + `user_id` varchar(16) NOT NULL, + `date_created` datetime NOT NULL, + `last_updated` datetime NOT NULL, + `session_data` LONGTEXT NOT NULL, + PRIMARY KEY (`session_store_id`) +) ENGINE = InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; \ No newline at end of file Modified: trunk/0.3/setup/schema.pgsql.sql =================================================================== --- trunk/0.3/setup/schema.pgsql.sql 2009-08-21 14:47:11 UTC (rev 129) +++ trunk/0.3/setup/schema.pgsql.sql 2009-08-21 16:16:22 UTC (rev 130) @@ -104,3 +104,19 @@ expiration timestamp NOT NULL ); + +-- +-- Store session data in here. +-- Idea originally from: http://www.developertutorials.com/tutorials/php/saving-php-session-data-database-050711 +-- + +CREATE TABLE cswal_session_store_table ( + session_store_id serial NOT NULL PRIMARY KEY, + session_id varchar(32) NOT NULL DEFAULT '' UNIQUE, + user_id varchar(16), + date_created timestamp NOT NULL DEFAULT NOW(), + last_updated timestamp NOT NULL DEFAULT NOW(), + session_data text +); + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |