b2evolution PHP Cross Reference Blogging Systems

Source: /inc/sessions/model/_sessions.install.php - 150 lines - 6978 bytes - Text - Print

Description: This is the install file for the core modules This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This is the install file for the core modules
   4   *
   5   * This file is part of the evoCore framework - {@link http://evocore.net/}
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   9   *
  10   * {@internal License choice
  11   * - If you have received this file as part of a package, please find the license.txt file in
  12   *   the same folder or the closest folder above for complete license terms.
  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  14   *   then you must choose one of the following licenses before using the file:
  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  17   * }}
  18   *
  19   * {@internal Open Source relicensing agreement:
  20   * }}
  21   *
  22   * @package evocore
  23   *
  24   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  25   * @author fplanque: Francois PLANQUE.
  26   *
  27   * @version $Id: _sessions.install.php 6136 2014-03-08 07:59:48Z manuel $
  28   */
  29  if( !defined('EVO_CONFIG_LOADED') ) die( 'Please, do not access this page directly.' );
  30  
  31  
  32  global $db_storage_charset;
  33  
  34  
  35  /**
  36   * The b2evo database scheme.
  37   *
  38   * This gets updated through {@link db_delta()} which generates the queries needed to get
  39   * to this scheme.
  40   *
  41   * Please see {@link db_delta()} for things to take care of.
  42   */
  43  $schema_queries['T_sessions'] = array(
  44          'Creating table for active sessions',
  45          "CREATE TABLE T_sessions (
  46              sess_ID          INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  47              sess_key         CHAR(32) NULL,
  48              sess_start_ts    TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00',
  49              sess_lastseen_ts TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT 'User last logged activation time. Value may be off by up to 60 seconds',
  50              sess_ipaddress   VARCHAR(39) NOT NULL DEFAULT '',
  51              sess_user_ID     INT(10) DEFAULT NULL,
  52              sess_data        MEDIUMBLOB DEFAULT NULL,
  53              sess_device      VARCHAR(8) NOT NULL DEFAULT '',
  54              PRIMARY KEY      ( sess_ID ),
  55            KEY sess_user_ID (sess_user_ID)
  56          ) ENGINE = myisam DEFAULT CHARACTER SET = $db_storage_charset" );
  57          // NOTE: sess_lastseen is only relevant/used by Sessions class (+ stats) and results in a quite large index (file size wise)
  58          // NOTE: sess_data is (MEDIUM)BLOB because e.g. serialize() does not completely convert binary data to text
  59  
  60  $schema_queries['T_basedomains'] = array(
  61          'Creating table for base domains',
  62          "CREATE TABLE T_basedomains (
  63              dom_ID     INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  64              dom_name   VARCHAR(250) NOT NULL DEFAULT '',
  65              dom_status ENUM('unknown','whitelist','blacklist') NOT NULL DEFAULT 'unknown',
  66              dom_type   ENUM('unknown','normal','searcheng','aggregator','email') NOT NULL DEFAULT 'unknown',
  67              PRIMARY KEY     (dom_ID),
  68              UNIQUE dom_type_name (dom_type, dom_name)
  69          ) ENGINE = myisam DEFAULT CHARACTER SET = $db_storage_charset" );
  70  
  71  $schema_queries['T_track__keyphrase'] = array(
  72          'Creating table for Hit-Logs',
  73          "CREATE TABLE T_track__keyphrase (
  74              keyp_ID      INT UNSIGNED NOT NULL AUTO_INCREMENT,
  75              keyp_phrase  VARCHAR( 255 ) NOT NULL,
  76              keyp_count_refered_searches INT UNSIGNED DEFAULT 0,
  77              keyp_count_internal_searches INT UNSIGNED DEFAULT 0,
  78              PRIMARY KEY        ( keyp_ID ),
  79              UNIQUE keyp_phrase ( keyp_phrase )
  80          ) ENGINE = myisam DEFAULT CHARACTER SET = $db_storage_charset" );
  81  
  82  
  83  $schema_queries['T_hitlog'] = array(
  84          'Creating table for Hit-Logs',
  85          "CREATE TABLE T_hitlog (
  86              hit_ID                INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  87              hit_sess_ID           INT UNSIGNED,
  88              hit_datetime          DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00',
  89              hit_uri               VARCHAR(250) DEFAULT NULL,
  90              hit_disp              VARCHAR(30) DEFAULT NULL,
  91              hit_ctrl              VARCHAR(30) DEFAULT NULL,
  92              hit_action            VARCHAR(30) DEFAULT NULL,
  93              hit_type              ENUM('standard','rss','admin','ajax', 'service') DEFAULT 'standard' NOT NULL,
  94              hit_referer_type      ENUM('search','special','spam','referer','direct','self') NOT NULL,
  95              hit_referer           VARCHAR(250) DEFAULT NULL,
  96              hit_referer_dom_ID    INT UNSIGNED DEFAULT NULL,
  97              hit_keyphrase_keyp_ID INT UNSIGNED DEFAULT NULL,
  98              hit_keyphrase         VARCHAR(255) DEFAULT NULL,
  99              hit_serprank          INT UNSIGNED DEFAULT NULL,
 100              hit_blog_ID           int(11) UNSIGNED NULL DEFAULT NULL,
 101              hit_remote_addr       VARCHAR(40) DEFAULT NULL,
 102              hit_agent_type        ENUM('robot','browser','unknown') DEFAULT 'unknown' NOT NULL,
 103              hit_response_code     INT DEFAULT NULL,
 104              PRIMARY KEY              (hit_ID),
 105              INDEX hit_blog_ID        ( hit_blog_ID ),
 106              INDEX hit_uri            ( hit_uri ),
 107              INDEX hit_referer_dom_ID ( hit_referer_dom_ID ),
 108              INDEX hit_remote_addr    ( hit_remote_addr ),
 109              INDEX hit_sess_ID        ( hit_sess_ID )
 110          ) ENGINE = myisam DEFAULT CHARACTER SET = $db_storage_charset" );
 111          // Note: hit_remote_addr is used for goal matching stats
 112          // fp> needed?             INDEX hit_keyphrase_keyp_ID( hit_keyphrase_keyp_ID ),
 113          // dh> There appear too many indexes here, which makes inserting hits rather
 114          //     slow! If the indexes need to stay, would it be possible to queue
 115          //     the hit logs and let them get handled by cron?!
 116          //     Well, converting the table to MyISAM (from InnoDB) helped a lot..
 117          // fp> Yes we do have a chronic problem with the hitlogging
 118          //     The best solution would indeed be to write to a non indexed MyISAM table
 119          //     and then to consolidate the data once per day/hour (not sure) to tables that will be used for viewing stats
 120          //     ALSO ideally we would not keep all the hit data but only CONSOLIDATED data
 121          //     needed for reports, e-g: this date = this many hits of type browser/robot/rss etc but not necessarilly the detail
 122          //     MAYBE a 2 step process would make sense?
 123          //      1) write to MyISAM and cron every x minutes to replicate to indexed table
 124          //      2) consolidate once a day
 125  
 126  $schema_queries['T_track__goal'] = array(
 127          'Creating goals table',
 128          "CREATE TABLE T_track__goal(
 129            goal_ID int(10) unsigned NOT NULL auto_increment,
 130            goal_name varchar(50) default NULL,
 131            goal_key varchar(32) default NULL,
 132            goal_redir_url varchar(255) default NULL,
 133            goal_default_value double default NULL,
 134            PRIMARY KEY (goal_ID),
 135            UNIQUE KEY goal_key (goal_key)
 136          ) ENGINE = myisam DEFAULT CHARACTER SET = $db_storage_charset" );
 137  
 138  $schema_queries['T_track__goalhit'] = array(
 139          'Creating goal hits table',
 140          "CREATE TABLE T_track__goalhit (
 141            ghit_ID int(10) unsigned NOT NULL auto_increment,
 142            ghit_goal_ID    int(10) unsigned NOT NULL,
 143            ghit_hit_ID     int(10) unsigned NOT NULL,
 144            ghit_params     TEXT default NULL,
 145            PRIMARY KEY  (ghit_ID),
 146            KEY ghit_goal_ID (ghit_goal_ID),
 147            KEY ghit_hit_ID (ghit_hit_ID)
 148          ) ENGINE = myisam DEFAULT CHARACTER SET = $db_storage_charset" );
 149  
 150  ?>

title

Description

title

Description

title

Description

title

title

Body