root/dev/common/autoupgrade.php @ 47

Revision 47, 1.4 KB (checked in by exi, 14 years ago)

Added Custom Shipvalue System, to be enabled in options, as always with autoupgrade(tm) ;)
Changed commenttablefield id to lowercase via autoupgrade.php, compat added in comments.php
Disabled immediate portrait update on IGB-Access

Line 
1<?php
2require_once("db.php");
3function check_commenttable()
4{
5    $qry = new DBQuery();
6    $query = 'select count(*) from kb3_comments';
7    $result = mysql_query($query);
8    if ($result)
9    {
10        check_commenttablerow();
11        return;
12    }
13    $query = 'CREATE TABLE `kb3_comments` (
14`ID` INT NOT NULL AUTO_INCREMENT ,
15`kll_id` INT NOT NULL ,
16`comment` TEXT NOT NULL ,
17`name` TINYTEXT NOT NULL ,
18`posttime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
19PRIMARY KEY ( `ID` )
20) TYPE = MYISAM';
21    $qry->execute($query);
22}
23
24function check_commenttablerow()
25{
26    $qry = new DBQuery();
27    $query = 'select count(posttime) from kb3_comments';
28    $result = mysql_query($query);
29    if ($result)
30    {
31        $query = 'ALTER TABLE `kb3_comments` CHANGE `ID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT';
32        $qry->execute($query);
33        return;
34    }
35    $query = 'ALTER TABLE `kb3_comments` ADD `posttime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL';
36    $qry->execute($query);
37}
38
39function check_shipvaltable()
40{
41    $qry = new DBQuery();
42    $query = 'select count(*) from kb3_ships_values';
43    $result = mysql_query($query);
44    if ($result)
45    {
46        return;
47    }
48    $query = 'CREATE TABLE `kb3_ships_values` (
49`shp_id` INT( 11 ) NOT NULL ,
50`shp_value` BIGINT( 4 ) NOT NULL ,
51INDEX ( `shp_id` )
52) TYPE = MYISAM ;';
53    $qry->execute($query);
54}
55
56?>
Note: See TracBrowser for help on using the browser.