ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilWikiDBCreator Class Reference

Only temporary Wiki table creator. More...

+ Collaboration diagram for ilWikiDBCreator:

Static Public Member Functions

static createTables ()

Detailed Description

Only temporary Wiki table creator.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 33 of file class.ilWikiDBCreator.php.

Member Function Documentation

static ilWikiDBCreator::createTables ( )
static

Definition at line 36 of file class.ilWikiDBCreator.php.

References $ilDB, and $ilSetting.

{
global $ilDB, $ilSetting;
$wiki_db = $ilSetting->get("wiki_db");
if ($wiki_db <= 0)
{
// wiki data
$q = "DROP TABLE IF EXISTS il_wiki_data";
$ilDB->query($q);
$q = "CREATE TABLE il_wiki_data (
id int NOT NULL PRIMARY KEY,
startpage varchar(200) NOT NULL DEFAULT '',
short varchar(20) NOT NULL DEFAULT '',
online TINYINT DEFAULT 0
)";
$ilDB->query($q);
$q = "DROP TABLE IF EXISTS il_wiki_page";
$ilDB->query($q);
$q = "CREATE TABLE il_wiki_page (
id int AUTO_INCREMENT NOT NULL PRIMARY KEY,
title varchar(200) NOT NULL DEFAULT '',
wiki_id int NOT NULL
)";
$ilDB->query($q);
$ilSetting->set("wiki_db", 1);
}
//
if ($wiki_db == 1)
{
$q = "DROP TABLE IF EXISTS page_history";
$ilDB->query($q);
$q = "CREATE TABLE page_history (
page_id int NOT NULL DEFAULT 0,
parent_type varchar(4) NOT NULL DEFAULT '',
hdate datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
parent_id int,
content mediumtext,
PRIMARY KEY (page_id, parent_type, hdate)
)";
$ilDB->query($q);
$ilSetting->set("wiki_db", 2);
}
if ($wiki_db == 2)
{
$q = "ALTER TABLE page_object ADD COLUMN user int DEFAULT 0";
$ilDB->query($q);
$q = "ALTER TABLE page_history ADD COLUMN user int DEFAULT 0";
$ilDB->query($q);
$ilSetting->set("wiki_db", 3);
}
if ($wiki_db == 3)
{
$q = "DROP TABLE IF EXISTS page_history";
$ilDB->query($q);
$q = "CREATE TABLE page_history (
page_id int NOT NULL DEFAULT 0,
parent_type varchar(4) NOT NULL DEFAULT '',
hdate datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
parent_id int,
nr int,
user int,
content mediumtext,
PRIMARY KEY (page_id, parent_type, hdate)
)";
$ilDB->query($q);
$ilSetting->set("wiki_db", 4);
}
if ($wiki_db == 4)
{
$q = "ALTER TABLE page_object ADD COLUMN view_cnt int DEFAULT 0";
$ilDB->query($q);
$ilSetting->set("wiki_db", 5);
}
if ($wiki_db == 5)
{
$q = "ALTER TABLE page_object ADD COLUMN last_change TIMESTAMP";
$ilDB->query($q);
$q = "ALTER TABLE page_object ADD COLUMN created DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'";
$ilDB->query($q);
$ilSetting->set("wiki_db", 6);
}
}

The documentation for this class was generated from the following file: