b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.8) [ class tree: main ] [ index: main ] [ all elements ]

Source for file _db_schema.inc.php

Documentation is available at _db_schema.inc.php

  1. <?php
  2. /**
  3.  * This file holds the b2evo database scheme.
  4.  *
  5.  * @version $Id: _db_schema.inc.php,v 1.19.2.7 2006/11/30 22:49:30 fplanque Exp $
  6.  */
  7. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  8.  
  9. /**
  10.  * The b2evo database scheme.
  11.  *
  12.  * This gets updated through {@link db_delta()} which generates the queries needed to get
  13.  * to this scheme.
  14.  *
  15.  * Please see {@link db_delta()} for things to take care of.
  16.  *
  17.  * @global array 
  18.  */
  19. global $schema_queries;
  20.  
  21. $schema_queries array(
  22.     'T_groups' => array(
  23.         'Creating table for Groups',
  24.         "CREATE TABLE T_groups (
  25.             grp_ID int(11) NOT NULL auto_increment,
  26.             grp_name varchar(50) NOT NULL default '',
  27.             grp_perm_admin enum('none','hidden','visible') NOT NULL default 'visible',
  28.             grp_perm_blogs enum('user','viewall','editall') NOT NULL default 'user',
  29.             grp_perm_stats enum('none','view','edit') NOT NULL default 'none',
  30.             grp_perm_spamblacklist enum('none','view','edit') NOT NULL default 'none',
  31.             grp_perm_options enum('none','view','edit') NOT NULL default 'none',
  32.             grp_perm_users enum('none','view','edit') NOT NULL default 'none',
  33.             grp_perm_templates TINYINT NOT NULL DEFAULT 0,
  34.             grp_perm_files enum('none','view','add','edit') NOT NULL default 'none',
  35.             PRIMARY KEY grp_ID (grp_ID)
  36.         )" ),
  37.  
  38.     'T_coll_user_perms' => array(
  39.         'Creating table for Blog-User permissions',
  40.         "CREATE TABLE T_coll_user_perms (
  41.             bloguser_blog_ID int(11) unsigned NOT NULL default 0,
  42.             bloguser_user_ID int(11) unsigned NOT NULL default 0,
  43.             bloguser_ismember tinyint NOT NULL default 0,
  44.             bloguser_perm_poststatuses set('published','deprecated','protected','private','draft') NOT NULL default '',
  45.             bloguser_perm_delpost tinyint NOT NULL default 0,
  46.             bloguser_perm_comments tinyint NOT NULL default 0,
  47.             bloguser_perm_cats tinyint NOT NULL default 0,
  48.             bloguser_perm_properties tinyint NOT NULL default 0,
  49.             bloguser_perm_media_upload tinyint NOT NULL default 0,
  50.             bloguser_perm_media_browse tinyint NOT NULL default 0,
  51.             bloguser_perm_media_change tinyint NOT NULL default 0,
  52.             PRIMARY KEY bloguser_pk (bloguser_blog_ID,bloguser_user_ID)
  53.         )" ),
  54.  
  55.     'T_settings' => array(
  56.         'Creating table for Settings',
  57.         "CREATE TABLE T_settings (
  58.             set_name VARCHAR( 30 ) NOT NULL ,
  59.             set_value VARCHAR( 255 ) NULL ,
  60.             PRIMARY KEY ( set_name )
  61.         )" ),
  62.  
  63.     'T_users' => array(
  64.         'Creating table for Users',
  65.         "CREATE TABLE T_users (
  66.             user_ID int(11) unsigned NOT NULL auto_increment,
  67.             user_login varchar(20) NOT NULL,
  68.             user_pass CHAR(32) NOT NULL,
  69.             user_firstname varchar(50) NULL,
  70.             user_lastname varchar(50) NULL,
  71.             user_nickname varchar(50) NULL,
  72.             user_icq int(11) unsigned NULL,
  73.             user_email varchar(255) NOT NULL,
  74.             user_url varchar(255) NULL,
  75.             user_ip varchar(15) NULL,
  76.             user_domain varchar(200) NULL,
  77.             user_browser varchar(200) NULL,
  78.             dateYMDhour datetime NOT NULL,
  79.             user_level int unsigned DEFAULT 0 NOT NULL,
  80.             user_aim varchar(50) NULL,
  81.             user_msn varchar(100) NULL,
  82.             user_yim varchar(50) NULL,
  83.             user_locale varchar(20) DEFAULT 'en-EU' NOT NULL,
  84.             user_idmode varchar(20) NOT NULL DEFAULT 'login',
  85.             user_allow_msgform TINYINT NOT NULL DEFAULT '1',
  86.             user_notify tinyint(1) NOT NULL default 1,
  87.             user_showonline tinyint(1) NOT NULL default 1,
  88.             user_grp_ID int(4) NOT NULL default 1,
  89.             user_validated TINYINT(1) NOT NULL DEFAULT 0,
  90.             PRIMARY KEY user_ID (user_ID),
  91.             UNIQUE user_login (user_login),
  92.             KEY user_grp_ID (user_grp_ID)
  93.         )" ),
  94.  
  95.     'T_blogs' => array(
  96.         'Creating table for Blogs',
  97.         "CREATE TABLE T_blogs (
  98.             blog_ID int(11) unsigned NOT NULL auto_increment,
  99.             blog_shortname varchar(12) NULL default '',
  100.             blog_name varchar(50) NOT NULL default '',
  101.             blog_tagline varchar(250) NULL default '',
  102.             blog_description varchar(250) NULL default '',
  103.             blog_longdesc TEXT NULL DEFAULT NULL,
  104.             blog_locale VARCHAR(20) NOT NULL DEFAULT 'en-EU',
  105.             blog_access_type VARCHAR(10) NOT NULL DEFAULT 'index.php',
  106.             blog_siteurl varchar(120) NOT NULL default '',
  107.             blog_staticfilename varchar(30) NULL default NULL,
  108.             blog_stub VARCHAR(255) NOT NULL DEFAULT 'stub',
  109.             blog_urlname VARCHAR(255) NOT NULL DEFAULT 'urlname',
  110.             blog_notes TEXT NULL,
  111.             blog_keywords tinytext,
  112.             blog_allowcomments VARCHAR(20) NOT NULL default 'post_by_post',
  113.             blog_allowtrackbacks TINYINT(1) NOT NULL default 1,
  114.             blog_allowpingbacks TINYINT(1) NOT NULL default 0,
  115.             blog_allowblogcss TINYINT(1) NOT NULL default 1,
  116.             blog_allowusercss TINYINT(1) NOT NULL default 1,
  117.             blog_pingb2evonet TINYINT(1) NOT NULL default 0,
  118.             blog_pingtechnorati TINYINT(1) NOT NULL default 0,
  119.             blog_pingweblogs TINYINT(1) NOT NULL default 0,
  120.             blog_pingblodotgs TINYINT(1) NOT NULL default 0,
  121.             blog_default_skin VARCHAR(30) NOT NULL DEFAULT 'custom',
  122.             blog_force_skin TINYINT(1) NOT NULL default 0,
  123.             blog_disp_bloglist TINYINT(1) NOT NULL DEFAULT 1,
  124.             blog_in_bloglist TINYINT(1) NOT NULL DEFAULT 1,
  125.             blog_links_blog_ID INT(11) NULL DEFAULT NULL,
  126.             blog_commentsexpire INT(4) NOT NULL DEFAULT 0,
  127.             blog_media_location ENUM( 'default', 'subdir', 'custom', 'none' ) DEFAULT 'default' NOT NULL,
  128.             blog_media_subdir VARCHAR( 255 ) NULL,
  129.             blog_media_fullpath VARCHAR( 255 ) NULL,
  130.             blog_media_url VARCHAR( 255 ) NULL,
  131.             blog_UID VARCHAR(20),
  132.             PRIMARY KEY blog_ID (blog_ID),
  133.             UNIQUE KEY blog_urlname (blog_urlname)
  134.         )" ),
  135.  
  136.     'T_coll_settings' => array(
  137.         'Creating collection settings table',
  138.         "CREATE TABLE T_coll_settings (
  139.             cset_coll_ID INT(11) UNSIGNED NOT NULL,
  140.             cset_name    VARCHAR( 30 ) NOT NULL,
  141.             cset_value   VARCHAR( 255 ) NULL,
  142.             PRIMARY KEY ( cset_coll_ID, cset_name )
  143.         )" ),
  144.  
  145.     'T_categories' => array(
  146.         'Creating table for Categories',
  147.         "CREATE TABLE T_categories (
  148.             cat_ID int(11) unsigned NOT NULL auto_increment,
  149.             cat_parent_ID int(11) unsigned NULL,
  150.             cat_name tinytext NOT NULL,
  151.             cat_blog_ID int(11) unsigned NOT NULL default 2,
  152.             cat_description VARCHAR(250) NULL DEFAULT NULL,
  153.             cat_longdesc TEXT NULL DEFAULT NULL,
  154.             cat_icon VARCHAR(30) NULL DEFAULT NULL,
  155.             PRIMARY KEY cat_ID (cat_ID),
  156.             KEY cat_blog_ID (cat_blog_ID),
  157.             KEY cat_parent_ID (cat_parent_ID)
  158.         )" ),
  159.  
  160.     'T_posts' => array(
  161.         'Creating table for Posts',
  162.         "CREATE TABLE T_posts (
  163.             post_ID               int(11) unsigned NOT NULL auto_increment,
  164.             post_parent_ID        int(11) unsigned NULL,
  165.             post_creator_user_ID  int(11) unsigned NOT NULL,
  166.             post_lastedit_user_ID int(11) unsigned NULL,
  167.             post_assigned_user_ID int(11) unsigned NULL,
  168.             post_datestart        datetime NOT NULL,
  169.             post_datedeadline     datetime NULL,
  170.             post_datecreated      datetime NULL,
  171.             post_datemodified     datetime NOT NULL,
  172.             post_status           enum('published','deprecated','protected','private','draft') NOT NULL default 'published',
  173.             post_pst_ID           int(11) unsigned NULL,
  174.             post_ptyp_ID          int(11) unsigned NULL,
  175.             post_locale           VARCHAR(20) NOT NULL DEFAULT 'en-EU',
  176.             post_content          text NULL,
  177.             post_title            text NOT NULL,
  178.             post_urltitle         VARCHAR(50) NULL DEFAULT NULL,
  179.             post_url              VARCHAR(255) NULL DEFAULT NULL,
  180.             post_main_cat_ID      int(11) unsigned NOT NULL,
  181.             post_flags            SET( 'pingsdone', 'imported'),
  182.             post_views            INT(11) UNSIGNED NOT NULL DEFAULT 0,
  183.             post_wordcount        int(11) default NULL,
  184.             post_comment_status   ENUM('disabled', 'open', 'closed') NOT NULL DEFAULT 'open',
  185.             post_commentsexpire   DATETIME DEFAULT NULL,
  186.             post_renderers        TEXT NOT NULL,
  187.             post_priority         int(11) unsigned null,
  188.             PRIMARY KEY post_ID( post_ID ),
  189.             UNIQUE post_urltitle( post_urltitle ),
  190.             INDEX post_datestart( post_datestart ),
  191.             INDEX post_main_cat_ID( post_main_cat_ID ),
  192.             INDEX post_creator_user_ID( post_creator_user_ID ),
  193.             INDEX post_status( post_status ),
  194.             INDEX post_parent_ID( post_parent_ID ),
  195.             INDEX post_assigned_user_ID( post_assigned_user_ID ),
  196.             INDEX post_ptyp_ID( post_ptyp_ID ),
  197.             INDEX post_pst_ID( post_pst_ID )
  198.         )" ),
  199.  
  200.     'T_postcats' => array(
  201.         'Creating table for Categories-to-Posts relationships',
  202.         "CREATE TABLE T_postcats (
  203.             postcat_post_ID int(11) unsigned NOT NULL,
  204.             postcat_cat_ID int(11) unsigned NOT NULL,
  205.             PRIMARY KEY postcat_pk (postcat_post_ID,postcat_cat_ID),
  206.             UNIQUE catpost ( postcat_cat_ID, postcat_post_ID )
  207.         )" ),
  208.  
  209.     'T_comments' => array(
  210.         'Creating table for Comments',
  211.         "CREATE TABLE T_comments (
  212.             comment_ID        int(11) unsigned NOT NULL auto_increment,
  213.             comment_post_ID   int(11) unsigned NOT NULL default '0',
  214.             comment_type enum('comment','linkback','trackback','pingback') NOT NULL default 'comment',
  215.             comment_status ENUM('published', 'deprecated', 'protected', 'private', 'draft') DEFAULT 'published' NOT NULL,
  216.             comment_author_ID int unsigned NULL default NULL,
  217.             comment_author varchar(100) NULL,
  218.             comment_author_email varchar(255) NULL,
  219.             comment_author_url varchar(255) NULL,
  220.             comment_author_IP varchar(23) NOT NULL default '',
  221.             comment_date datetime NOT NULL,
  222.             comment_content text NOT NULL,
  223.             comment_karma int(11) NOT NULL default '0',
  224.             comment_spam_karma TINYINT NULL,
  225.             comment_allow_msgform TINYINT NOT NULL DEFAULT '0',
  226.             PRIMARY KEY comment_ID (comment_ID),
  227.             KEY comment_post_ID (comment_post_ID),
  228.             KEY comment_date (comment_date),
  229.             KEY comment_type (comment_type)
  230.         )" ),
  231.  
  232.     'T_locales' => array(
  233.         'Creating table for Locales',
  234.         "CREATE TABLE T_locales (
  235.             loc_locale varchar(20) NOT NULL default '',
  236.             loc_charset varchar(15) NOT NULL default 'iso-8859-1',
  237.             loc_datefmt varchar(10) NOT NULL default 'y-m-d',
  238.             loc_timefmt varchar(10) NOT NULL default 'H:i:s',
  239.             loc_startofweek TINYINT UNSIGNED NOT NULL DEFAULT 1,
  240.             loc_name varchar(40) NOT NULL default '',
  241.             loc_messages varchar(20) NOT NULL default '',
  242.             loc_priority tinyint(4) UNSIGNED NOT NULL default '0',
  243.             loc_enabled tinyint(4) NOT NULL default '1',
  244.             PRIMARY KEY loc_locale( loc_locale )
  245.         ) COMMENT='saves available locales'
  246.         " ),
  247.  
  248.     'T_antispam' => array(
  249.         'Creating table for Antispam Blacklist',
  250.         "CREATE TABLE T_antispam (
  251.             aspm_ID bigint(11) NOT NULL auto_increment,
  252.             aspm_string varchar(80) NOT NULL,
  253.             aspm_source enum( 'local','reported','central' ) NOT NULL default 'reported',
  254.             PRIMARY KEY aspm_ID (aspm_ID),
  255.             UNIQUE aspm_string (aspm_string)
  256.         )" ),
  257.  
  258.     'T_sessions' => array(
  259.         'Creating table for active sessions',
  260.         "CREATE TABLE T_sessions (
  261.             sess_ID        INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  262.             sess_key       CHAR(32) NULL,
  263.             sess_lastseen  DATETIME NOT NULL,
  264.             sess_ipaddress VARCHAR(15) NOT NULL DEFAULT '',
  265.             sess_user_ID   INT(10) DEFAULT NULL,
  266.             sess_data      TEXT DEFAULT NULL,
  267.             PRIMARY KEY( sess_ID )
  268.         )" ),
  269.  
  270.     'T_usersettings' => array(
  271.         'Creating user settings table',
  272.         "CREATE TABLE T_usersettings (
  273.             uset_user_ID INT(11) UNSIGNED NOT NULL,
  274.             uset_name    VARCHAR( 30 ) NOT NULL,
  275.             uset_value   VARCHAR( 255 ) NULL,
  276.             PRIMARY KEY ( uset_user_ID, uset_name )
  277.         )" ),
  278.  
  279.     'T_itemstatuses' => array(
  280.         'Creating table for Post Statuses',
  281.         "CREATE TABLE T_itemstatuses (
  282.             pst_ID   int(11) unsigned not null AUTO_INCREMENT,
  283.             pst_name varchar(30)      not null,
  284.             primary key ( pst_ID )
  285.         )" ),
  286.  
  287.     'T_itemtypes' => array(
  288.         'Creating table for Post Types',
  289.         "CREATE TABLE T_itemtypes (
  290.             ptyp_ID   int(11) unsigned not null AUTO_INCREMENT,
  291.             ptyp_name varchar(30)      not null,
  292.             primary key (ptyp_ID)
  293.         )" ),
  294.  
  295.     'T_files' => array(
  296.         'Creating table for File Meta Data',
  297.         "CREATE TABLE T_files (
  298.             file_ID        int(11) unsigned  not null AUTO_INCREMENT,
  299.             file_root_type enum('absolute','user','group','collection') not null default 'absolute',
  300.             file_root_ID   int(11) unsigned  not null default 0,
  301.             file_path      varchar(255)      not null default '',
  302.             file_title     varchar(255),
  303.             file_alt       varchar(255),
  304.             file_desc      text,
  305.             primary key (file_ID),
  306.             unique file (file_root_type, file_root_ID, file_path)
  307.         )" ),
  308.  
  309.     'T_basedomains' => array(
  310.         'Creating table for base domains',
  311.         "CREATE TABLE T_basedomains (
  312.             dom_ID     INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  313.             dom_name   VARCHAR(250) NOT NULL DEFAULT '',
  314.             dom_status ENUM('unknown','whitelist','blacklist') NOT NULL DEFAULT 'unknown',
  315.             dom_type   ENUM('unknown','normal','searcheng','aggregator') NOT NULL DEFAULT 'unknown',
  316.             PRIMARY KEY (dom_ID),
  317.             UNIQUE (dom_name)
  318.         )" ),
  319.  
  320.     'T_useragents' => array(
  321.         'Creating table for user agents',
  322.         "CREATE TABLE T_useragents (
  323.             agnt_ID        INT UNSIGNED NOT NULL AUTO_INCREMENT,
  324.             agnt_signature VARCHAR(250) NOT NULL,
  325.             agnt_type      ENUM('rss','robot','browser','unknown') DEFAULT 'unknown' NOT NULL ,
  326.             PRIMARY KEY (agnt_ID)
  327.         )" ),
  328.  
  329.     'T_hitlog' => array(
  330.         'Creating table for Hit-Logs',
  331.         "CREATE TABLE T_hitlog (
  332.             hit_ID             INT(11) NOT NULL AUTO_INCREMENT,
  333.             hit_sess_ID        INT UNSIGNED,
  334.             hit_datetime       DATETIME NOT NULL,
  335.             hit_uri            VARCHAR(250) DEFAULT NULL,
  336.             hit_referer_type   ENUM('search','blacklist','referer','direct') NOT NULL,
  337.             hit_referer        VARCHAR(250) DEFAULT NULL,
  338.             hit_referer_dom_ID INT UNSIGNED DEFAULT NULL,
  339.             hit_blog_ID        int(11) UNSIGNED NULL DEFAULT NULL,
  340.             hit_remote_addr    VARCHAR(40) DEFAULT NULL,
  341.             hit_agnt_ID        INT UNSIGNED NULL,
  342.             PRIMARY KEY (hit_ID),
  343.             INDEX hit_datetime ( hit_datetime ),
  344.             INDEX hit_blog_ID (hit_blog_ID)
  345.         )" )// TODO: more indexes?
  346.  
  347.     'T_subscriptions' => array(
  348.         'Creating table for subscriptions',
  349.         "CREATE TABLE T_subscriptions (
  350.             sub_coll_ID     int(11) unsigned    not null,
  351.             sub_user_ID     int(11) unsigned    not null,
  352.             sub_items       tinyint(1)          not null,
  353.             sub_comments    tinyint(1)          not null,
  354.             primary key (sub_coll_ID, sub_user_ID)
  355.         )" ),
  356.  
  357.     'T_coll_group_perms' => array(
  358.         'Creating table for blog-group permissions',
  359.         "CREATE TABLE T_coll_group_perms (
  360.             bloggroup_blog_ID int(11) unsigned NOT NULL default 0,
  361.             bloggroup_group_ID int(11) unsigned NOT NULL default 0,
  362.             bloggroup_ismember tinyint NOT NULL default 0,
  363.             bloggroup_perm_poststatuses set('published','deprecated','protected','private','draft') NOT NULL default '',
  364.             bloggroup_perm_delpost tinyint NOT NULL default 0,
  365.             bloggroup_perm_comments tinyint NOT NULL default 0,
  366.             bloggroup_perm_cats tinyint NOT NULL default 0,
  367.             bloggroup_perm_properties tinyint NOT NULL default 0,
  368.             bloggroup_perm_media_upload tinyint NOT NULL default 0,
  369.             bloggroup_perm_media_browse tinyint NOT NULL default 0,
  370.             bloggroup_perm_media_change tinyint NOT NULL default 0,
  371.             PRIMARY KEY bloggroup_pk (bloggroup_blog_ID,bloggroup_group_ID)
  372.         )" ),
  373.  
  374.     'T_links' => array(
  375.         'Creating table for Post Links',
  376.         "CREATE TABLE T_links (
  377.             link_ID               int(11) unsigned  not null AUTO_INCREMENT,
  378.             link_datecreated      datetime          not null,
  379.             link_datemodified     datetime          not null,
  380.             link_creator_user_ID  int(11) unsigned  not null,
  381.             link_lastedit_user_ID int(11) unsigned  not null,
  382.             link_itm_ID           int(11) unsigned  NOT NULL,
  383.             link_dest_itm_ID      int(11) unsigned  NULL,
  384.             link_file_ID          int(11) unsigned  NULL,
  385.             link_ltype_ID         int(11) unsigned  NOT NULL default 1,
  386.             link_external_url     VARCHAR(255)      NULL,
  387.             link_title            TEXT              NULL,
  388.             PRIMARY KEY (link_ID),
  389.             INDEX link_itm_ID( link_itm_ID ),
  390.             INDEX link_dest_itm_ID (link_dest_itm_ID),
  391.             INDEX link_file_ID (link_file_ID)
  392.         )" ),
  393.  
  394.     'T_filetypes' => array(
  395.         'Creating table for file types',
  396.         'CREATE TABLE T_filetypes (
  397.             ftyp_ID int(11) unsigned NOT NULL auto_increment,
  398.             ftyp_extensions varchar(30) NOT NULL,
  399.             ftyp_name varchar(30) NOT NULL,
  400.             ftyp_mimetype varchar(50) NOT NULL,
  401.             ftyp_icon varchar(20) default NULL,
  402.             ftyp_viewtype varchar(10) NOT NULL,
  403.             ftyp_allowed tinyint(1) NOT NULL default 0,
  404.             PRIMARY KEY (ftyp_ID)
  405.         )' ),
  406.  
  407.     'T_plugins' => array(
  408.         'Creating plugins table',
  409.         "CREATE TABLE T_plugins (
  410.             plug_ID              INT(11) UNSIGNED NOT NULL auto_increment,
  411.             plug_priority        TINYINT NOT NULL default 50,
  412.             plug_classname       VARCHAR(40) NOT NULL default '',
  413.             plug_code            VARCHAR(32) NULL,
  414.             plug_apply_rendering ENUM( 'stealth', 'always', 'opt-out', 'opt-in', 'lazy', 'never' ) NOT NULL DEFAULT 'never',
  415.             plug_version         VARCHAR(42) NOT NULL default '0',
  416.             plug_status          ENUM( 'enabled', 'disabled', 'needs_config', 'broken' ) NOT NULL,
  417.             plug_spam_weight     TINYINT UNSIGNED NOT NULL DEFAULT 1,
  418.             PRIMARY KEY ( plug_ID ),
  419.             UNIQUE plug_code( plug_code ),
  420.             INDEX plug_status( plug_status )
  421.         )" ),
  422.  
  423.     'T_pluginsettings' => array(
  424.         'Creating plugin settings table',
  425.         'CREATE TABLE T_pluginsettings (
  426.             pset_plug_ID INT(11) UNSIGNED NOT NULL,
  427.             pset_name VARCHAR( 30 ) NOT NULL,
  428.             pset_value TEXT NULL,
  429.             PRIMARY KEY ( pset_plug_ID, pset_name )
  430.         )' ),
  431.  
  432.     'T_pluginusersettings' => array(
  433.         'Creating plugin user settings table',
  434.         'CREATE TABLE T_pluginusersettings (
  435.             puset_plug_ID INT(11) UNSIGNED NOT NULL,
  436.             puset_user_ID INT(11) UNSIGNED NOT NULL,
  437.             puset_name VARCHAR( 30 ) NOT NULL,
  438.             puset_value TEXT NULL,
  439.             PRIMARY KEY ( puset_plug_ID, puset_user_ID, puset_name )
  440.         )' ),
  441.  
  442.     'T_pluginevents' => array(
  443.         'Creating plugin events table',
  444.         'CREATE TABLE T_pluginevents(
  445.             pevt_plug_ID INT(11) UNSIGNED NOT NULL,
  446.             pevt_event VARCHAR(40) NOT NULL,
  447.             pevt_enabled TINYINT NOT NULL DEFAULT 1,
  448.             PRIMARY KEY( pevt_plug_ID, pevt_event )
  449.         )' ),
  450.  
  451.     'T_cron__task' => array(
  452.         'Creating cron tasks table',
  453.         'CREATE TABLE T_cron__task(
  454.            ctsk_ID              int(10) unsigned      not null AUTO_INCREMENT,
  455.            ctsk_start_datetime  datetime              not null,
  456.            ctsk_repeat_after    int(10) unsigned,
  457.            ctsk_name            varchar(50)           not null,
  458.            ctsk_controller      varchar(50)           not null,
  459.            ctsk_params          text,
  460.            primary key (ctsk_ID)
  461.         )' ),
  462.  
  463.     'T_cron__log' => array(
  464.         'Creating cron tasks table',
  465.         'CREATE TABLE T_cron__log(
  466.              clog_ctsk_ID              int(10) unsigned   not null,
  467.              clog_realstart_datetime   datetime           not null,
  468.              clog_realstop_datetime    datetime,
  469.              clog_status               enum(\'started\',\'finished\',\'error\',\'timeout\') not null default \'started\',
  470.              clog_messages             text,
  471.              primary key (clog_ctsk_ID)
  472.         )' ),
  473.  
  474. );
  475.  
  476.  
  477. /**
  478.  * Insert/modify data for a given old DB version.
  479.  *
  480.  * This function should only be used for creating default data of a table.
  481.  *
  482.  * It gets called on upgrades and new installs alike.
  483.  * $old_db_version is 0 for new installs.
  484.  *
  485.  * @param integer Old database version number (0 for new installs)
  486.  */
  487. function install_insert_default_data$old_db_version )
  488. {
  489.     global $Group_Admins$Group_Privileged$Group_Bloggers$Group_Users;
  490.     global $DB;
  491.  
  492.     if$old_db_version 8040 )
  493.     // upgrade to 0.8.7
  494.         echo 'Creating default blacklist entries... ';
  495.         $query "INSERT INTO T_antispam(aspm_string) VALUES ".
  496.         "('penis-enlargement'), ('online-casino'), ".
  497.         "('order-viagra'), ('order-phentermine'), ('order-xenical'), ".
  498.         "('order-prophecia'), ('sexy-lingerie'), ('-porn-'), ".
  499.         "('-adult-'), ('-tits-'), ('buy-phentermine'), ".
  500.         "('order-cheap-pills'), ('buy-xenadrine'),    ('xxx'), ".
  501.         "('paris-hilton'), ('parishilton'), ('camgirls'), ('adult-models')";
  502.         $DB->query$query );
  503.         echo "OK.<br />\n";
  504.     }
  505.  
  506.  
  507.     if$old_db_version 8050 )
  508.     // upgrade to 0.8.9
  509.         echo 'Creating default groups... ';
  510.         $Group_Admins new Group()// COPY !
  511.         $Group_Admins->set'name''Administrators' );
  512.         $Group_Admins->set'perm_admin''visible' );
  513.         $Group_Admins->set'perm_blogs''editall' );
  514.         $Group_Admins->set'perm_stats''edit' );
  515.         $Group_Admins->set'perm_spamblacklist''edit' );
  516.         $Group_Admins->set'perm_files''edit' );
  517.         $Group_Admins->set'perm_options''edit' );
  518.         $Group_Admins->set'perm_templates');
  519.         $Group_Admins->set'perm_users''edit' );
  520.         $Group_Admins->dbinsert();
  521.  
  522.         $Group_Privileged new Group()// COPY !
  523.         $Group_Privileged->set'name''Privileged Bloggers' );
  524.         $Group_Privileged->set'perm_admin''visible' );
  525.         $Group_Privileged->set'perm_blogs''viewall' );
  526.         $Group_Privileged->set'perm_stats''view' );
  527.         $Group_Privileged->set'perm_spamblacklist''edit' );
  528.         $Group_Privileged->set'perm_files''add' );
  529.         $Group_Privileged->set'perm_options''view' );
  530.         $Group_Privileged->set'perm_templates');
  531.         $Group_Privileged->set'perm_users''view' );
  532.         $Group_Privileged->dbinsert();
  533.  
  534.         $Group_Bloggers new Group()// COPY !
  535.         $Group_Bloggers->set'name''Bloggers' );
  536.         $Group_Bloggers->set'perm_admin''visible' );
  537.         $Group_Bloggers->set'perm_blogs''user' );
  538.         $Group_Bloggers->set'perm_stats''none' );
  539.         $Group_Bloggers->set'perm_spamblacklist''view' );
  540.         $Group_Bloggers->set'perm_files''view' );
  541.         $Group_Bloggers->set'perm_options''none' );
  542.         $Group_Bloggers->set'perm_templates');
  543.         $Group_Bloggers->set'perm_users''none' );
  544.         $Group_Bloggers->dbinsert();
  545.  
  546.         $Group_Users new Group()// COPY !
  547.         $Group_Users->set'name''Basic Users' );
  548.         $Group_Users->set'perm_admin''none' );
  549.         $Group_Users->set'perm_blogs''user' );
  550.         $Group_Users->set'perm_stats''none' );
  551.         $Group_Users->set'perm_spamblacklist''none' );
  552.         $Group_Users->set'perm_files''none' );
  553.         $Group_Users->set'perm_options''none' );
  554.         $Group_Users->set'perm_templates');
  555.         $Group_Users->set'perm_users''none' );
  556.         $Group_Users->dbinsert();
  557.         echo "OK.<br />\n";
  558.     }
  559.  
  560.  
  561.     if$old_db_version 9000 )
  562.     // Upgrade to Phoenix-Alpha
  563.         echo 'Creating default Post Types... ';
  564.         $DB->query"
  565.             INSERT INTO T_itemtypes ( ptyp_ID, ptyp_name )
  566.             VALUES ( 1, 'Post' ),
  567.                    ( 2, 'Link' )" );
  568.         echo "OK.<br />\n";
  569.     }
  570.  
  571.  
  572.     if$old_db_version 9100 )
  573.     // Upgrade to Phoenix-Beta
  574.         echo 'Creating default file types... ';
  575.         // Contribs: feel free to add more types here...
  576.         $DB->query"INSERT INTO T_filetypes VALUES
  577.                 (1, 'gif', 'GIF image', 'image/gif', 'image2.png', 'image', 1),
  578.                 (2, 'png', 'PNG image', 'image/png', 'image2.png', 'image', 1),
  579.                 (3, 'jpg', 'JPEG image', 'image/jpeg', 'image2.png', 'image', 1),
  580.                 (4, 'txt', 'Text file', 'text/plain', 'document.png', 'text', 1),
  581.                 (5, 'htm html', 'HTML file', 'text/html', 'html.png', 'browser', 0),
  582.                 (6, 'pdf', 'PDF file', 'application/pdf', 'pdf.png', 'browser', 1),
  583.                 (7, 'doc', 'Microsoft Word file', 'application/msword', 'doc.gif', 'external', 1),
  584.                 (8, 'xls', 'Microsoft Excel file', 'application/vnd.ms-excel', 'xls.gif', 'external', 1),
  585.                 (9, 'ppt', 'Powerpoint', 'application/vnd.ms-powerpoint', 'ppt.gif', 'external', 1),
  586.                 (10, 'pps', 'Powerpoint slideshow', 'pps', 'pps.gif', 'external', 1),
  587.                 (11, 'zip', 'Zip archive', 'application/zip', 'zip.gif', 'external', 1),
  588.                 (12, 'php php3 php4 php5 php6', 'Php files', 'application/x-httpd-php', 'php.gif', 'download', 0),
  589.                 (13, 'css', 'Cascading Style Sheet', 'text/css', '', 'text', 1)
  590.             " );
  591.         echo "OK.<br />\n";
  592.  
  593.         echo 'Giving Administrator Group edit perms on files... ';
  594.         $DB->query'UPDATE T_groups
  595.                      SET grp_perm_files = "edit"
  596.                      WHERE grp_ID = 1' );
  597.         echo "OK.<br />\n";
  598.  
  599.         echo 'Giving Administrator Group full perms on media for all blogs... ';
  600.         $DB->query'UPDATE T_coll_group_perms
  601.                      SET bloggroup_perm_media_upload = 1,
  602.                          bloggroup_perm_media_browse = 1,
  603.                          bloggroup_perm_media_change = 1
  604.                      WHERE bloggroup_group_ID = 1' );
  605.         echo "OK.<br />\n";
  606.  
  607.  
  608.         if$old_db_version >= 9000 )
  609.         // Uninstall all ALPHA (potentially incompatible) plugins
  610.             echo 'Uninstalling all existing plugins... ';
  611.             $DB->query'DELETE FROM T_plugins WHERE 1' );
  612.             $DB->query'DELETE FROM T_pluginevents WHERE 1' );
  613.             $DB->query'DELETE FROM T_pluginsettings WHERE 1' );
  614.             echo "OK.<br />\n";
  615.         }
  616.  
  617.         // NOTE: basic plugins get installed separatly for upgrade and install..
  618.     }
  619.  
  620.  
  621.     if$old_db_version 9200 )
  622.     {
  623.         /*
  624.          * CONTRIBUTORS: If you need changes and we haven't started a block for next release yet, put them here!
  625.          * Then create a new extension block, and increase db version numbers everywhere where needed in this file.
  626.          */
  627.  
  628.     }
  629. }
  630.  
  631. /*
  632.  nolog */
  633. ?>

Documentation generated on Tue, 18 Dec 2007 23:12:23 +0100 by phpDocumentor 1.4.0