Skip to content

Commit

Permalink
Added upgrading code
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Jan 20, 2016
1 parent 7239b33 commit 14d5cbb
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 1 deletion.
2 changes: 2 additions & 0 deletions language/english.php
Expand Up @@ -2143,6 +2143,7 @@
'censorlist' => "Censor List",
'ip_lookup' => "IP Lookup",
'url_rewrite' => "Enable URL Rewrite",
'url_routing' => 'Enable URL routing',
'cdn_hosted' => "Use CDN-hosted copy of jQuery",
'meta_tags' => "Meta Tags",
'meta_description' => "Default Meta Description",
Expand Down Expand Up @@ -2364,6 +2365,7 @@
33 => array('Disabled' => 0, 'Enabled' => 1, 'Enabled (No Links)' => 2, 'Enabled (No Outbound Links)' => 3),
34 => array('grid' => 'grid', 'list' => 'list'),
35 => array('default' => 'default', 'Name (asc)' => 'NAME_ASC', 'Name (desc)' => 'NAME_DESC', 'Type (asc)' => 'TYPE_ASC', 'Type (desc)' => 'TYPE_DESC', 'Modified (asc)' => 'MODIFIED_ASC', 'Modified (desc)' => 'MODIFIED_DESC'),
36 => array('Disabled' => 0, 'Enabled (with index.php)' => 1, 'Enabled (without index.php)' => 2),
);

################################################################################
Expand Down
2 changes: 2 additions & 0 deletions language/english_utf-8.php
Expand Up @@ -2143,6 +2143,7 @@
'censorlist' => "Censor List",
'ip_lookup' => "IP Lookup",
'url_rewrite' => "Enable URL Rewrite",
'url_routing' => 'Enable URL routing',
'cdn_hosted' => "Use CDN-hosted copy of jQuery",
'meta_tags' => "Meta Tags",
'meta_description' => "Default Meta Description",
Expand Down Expand Up @@ -2364,6 +2365,7 @@
33 => array('Disabled' => 0, 'Enabled' => 1, 'Enabled (No Links)' => 2, 'Enabled (No Outbound Links)' => 3),
34 => array('grid' => 'grid', 'list' => 'list'),
35 => array('default' => 'default', 'Name (asc)' => 'NAME_ASC', 'Name (desc)' => 'NAME_DESC', 'Type (asc)' => 'TYPE_ASC', 'Type (desc)' => 'TYPE_DESC', 'Modified (asc)' => 'MODIFIED_ASC', 'Modified (desc)' => 'MODIFIED_DESC'),
36 => array('Disabled' => 0, 'Enabled (with index.php)' => 1, 'Enabled (without index.php)' => 2),
);

################################################################################
Expand Down
4 changes: 3 additions & 1 deletion language/japanese_utf-8.php
Expand Up @@ -2144,6 +2144,7 @@
'censorlist' => 'バッドワード',
'ip_lookup' => 'IPアドレス検索',
'url_rewrite' => 'URLリライト',
'url_routing' => 'URLルーティング',
'cdn_hosted' => 'CDNのjQueryを使用する',
'meta_tags' => 'メタタグ',
'meta_description' => 'サイトの説明文のメタタグ',
Expand Down Expand Up @@ -2357,7 +2358,8 @@
32 => array('表示しない' => 0, '記事のページにのみ表示する' => 1, '記事と話題の両方で表示する' => 2),
33 => array('無効にする' => 0, '有効にする' => 1, '有効にする(リンクなし)' => 2, '有効にする(外部リンクなし)' => 3),
34 => array('グリッド' => 'grid', 'リスト' => 'list'),
35 => array('デフォルト' => 'default', '名前(昇順)' => 'NAME_ASC', '名前(降順)' => 'NAME_DESC', '種類(昇順)' => 'TYPE_ASC', '種類(降順)' => 'TYPE_DESC', '変更日時(昇順)' => 'MODIFIED_ASC', '変更日時(降順)' => 'MODIFIED_DESC')
35 => array('デフォルト' => 'default', '名前(昇順)' => 'NAME_ASC', '名前(降順)' => 'NAME_DESC', '種類(昇順)' => 'TYPE_ASC', '種類(降順)' => 'TYPE_DESC', '変更日時(昇順)' => 'MODIFIED_ASC', '変更日時(降順)' => 'MODIFIED_DESC'),
36 => array('無効にする' => 0, '有効にする(index.phpあり)' => 1, '有効にする(index.phpなし)' => 2),
);

###############################################################################
Expand Down
1 change: 1 addition & 0 deletions public_html/admin/install/config-install.php
Expand Up @@ -57,6 +57,7 @@ function install_config()
$c->add('owner_name','','text',0,0,NULL,1000,TRUE, $me, 0);
$c->add('copyrightyear',date('Y'),'text',0,0,NULL,1440,FALSE, $me, 0);
$c->add('url_rewrite',FALSE,'select',0,0,1,1800,TRUE, $me, 0);
$c->add('url_routing',FALSE,'select',0,0,36,1850,TRUE, $me, 0);
$c->add('cdn_hosted',FALSE,'select',0,0,1,1900,TRUE, $me, 0);
$c->add('meta_tags',0,'select',0,0,23,2000,TRUE, $me, 0);
$c->add('meta_description','Geeklog - The secure Content Management System.','textarea',0,0,NULL,2010,TRUE, $me, 0);
Expand Down
9 changes: 9 additions & 0 deletions public_html/admin/install/lib-upgrade.php
Expand Up @@ -508,6 +508,15 @@ function INST_doDatabaseUpgrades($current_gl_version)
$_SQL = '';
break;

case '2.1.0':
require_once $_CONF['path'] . 'sql/updates/' . $_DB_dbms . '_2.1.0_to_2.1.2.php';
INST_updateDB($_SQL);

update_ConfValuesFor212();
$current_gl_version = '2.1.2';
$_SQL = '';
break;

default:
$done = true;
}
Expand Down
21 changes: 21 additions & 0 deletions sql/mssql_tableanddata.php
Expand Up @@ -253,6 +253,15 @@
) ON [PRIMARY]
";

$_SQL[] = "CREATE TABLE [dbo].[{$_TABLES['routes']}] (
[rid] [int] NOT NULL IDENTITY (1, 1),
[method] [int] NOT NULL DEFAULT 1,
[rule] [varchar] (255) NOT NULL DEFAULT '',
[route] [varchar] (255) NOT NULL DEFAULT '',
[priority] [int] NOT NULL DEFAULT 100
) ON [PRIMARY]
";

$_SQL[] = "
CREATE TABLE [dbo].[{$_TABLES['sessions']}] (
[sess_id] [numeric](10, 0) NOT NULL ,
Expand Down Expand Up @@ -654,6 +663,13 @@
) ON [PRIMARY]
";

$_SQL[] = "ALTER TABLE [dbo].[{$_TABLES['routes']}] ADD
CONSTRAINT [PK_{$_TABLES['routes']}] PRIMARY KEY CLUSTERED
(
[rid]
) ON [PRIMARY]
";

$_SQL[] = "ALTER TABLE [dbo].[{$_TABLES['sessions']}] ADD
CONSTRAINT [PK_{$_TABLES['sessions']}] PRIMARY KEY CLUSTERED
(
Expand Down Expand Up @@ -1521,6 +1537,11 @@
$_SQL[] = "INSERT INTO {$_TABLES['postmodes']} (code, name) VALUES ('plaintext','Plain Old Text')";
$_SQL[] = "INSERT INTO {$_TABLES['postmodes']} (code, name) VALUES ('html','HTML Formatted')";

$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/stats', '/stats.php')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/topic/@topic', '/index.php?topic=@topic')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/page/@page', '/staticpages/index.php?page=@page')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/article/@sid', '/article.php?story=@sid')";

$_SQL[] = "INSERT INTO {$_TABLES['sortcodes']} (code, name) VALUES ('ASC','Oldest First')";
$_SQL[] = "INSERT INTO {$_TABLES['sortcodes']} (code, name) VALUES ('DESC','Newest First')";

Expand Down
14 changes: 14 additions & 0 deletions sql/mysql_tableanddata.php
Expand Up @@ -250,6 +250,15 @@
) ENGINE=MyISAM
";

$_SQL[] = "CREATE TABLE {$_TABLES['routes']} (
`rid` int(11) NOT NULL AUTO_INCREMENT,
`method` int(11) NOT NULL DEFAULT '1',
`rule` varchar(255) NOT NULL DEFAULT '',
`route` varchar(255) NOT NULL DEFAULT '',
`priority` int(11) NOT NULL DEFAULT '100',
PRIMARY KEY (`rid`)
)";

$_SQL[] = "
CREATE TABLE {$_TABLES['sessions']} (
sess_id int(10) unsigned NOT NULL default '0',
Expand Down Expand Up @@ -799,6 +808,11 @@
$_DATA[] = "INSERT INTO {$_TABLES['postmodes']} (code, name) VALUES ('plaintext','Plain Old Text') ";
$_DATA[] = "INSERT INTO {$_TABLES['postmodes']} (code, name) VALUES ('html','HTML Formatted') ";

$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/stats', '/stats.php')";
$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/topic/@topic', '/index.php?topic=@topic')";
$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/page/@page', '/staticpages/index.php?page=@page')";
$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/article/@sid', '/article.php?story=@sid')";

$_DATA[] = "INSERT INTO {$_TABLES['sortcodes']} (code, name) VALUES ('ASC','Oldest First') ";
$_DATA[] = "INSERT INTO {$_TABLES['sortcodes']} (code, name) VALUES ('DESC','Newest First') ";

Expand Down
14 changes: 14 additions & 0 deletions sql/pgsql_tableanddata.php
Expand Up @@ -249,6 +249,15 @@
)
";

$_SQL[] = "CREATE TABLE {$_TABLES['routes']} (
rid SERIAL,
method int NOT NULL DEFAULT 1,
rule varchar(255) NOT NULL DEFAULT '',
route varchar(255) NOT NULL DEFAULT '',
priority int NOT NULL DEFAULT 100,
PRIMARY KEY (rid)
)";

$_SQL[] = "
CREATE TABLE {$_TABLES['sessions']} (
sess_id int NOT NULL default '0',
Expand Down Expand Up @@ -817,6 +826,11 @@
$_DATA[] = "INSERT INTO {$_TABLES['postmodes']} (code, name) VALUES ('plaintext','Plain Old Text') ";
$_DATA[] = "INSERT INTO {$_TABLES['postmodes']} (code, name) VALUES ('html','HTML Formatted') ";

$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/stats', '/stats.php')";
$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/topic/@topic', '/index.php?topic=@topic')";
$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/page/@page', '/staticpages/index.php?page=@page')";
$_DATA[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/article/@sid', '/article.php?story=@sid')";

$_DATA[] = "INSERT INTO {$_TABLES['sortcodes']} (code, name) VALUES ('ASC','Oldest First') ";
$_DATA[] = "INSERT INTO {$_TABLES['sortcodes']} (code, name) VALUES ('DESC','Newest First') ";

Expand Down
41 changes: 41 additions & 0 deletions sql/updates/mssql_2.1.0_to_2.1.2.php
@@ -0,0 +1,41 @@
<?php

// Create "routes" table
$_SQL[] = "CREATE TABLE [dbo].[{$_TABLES['routes']}] (
[rid] [int] NOT NULL IDENTITY (1, 1),
[method] [int] NOT NULL DEFAULT 1,
[rule] [varchar] (255) NOT NULL DEFAULT '',
[route] [varchar] (255) NOT NULL DEFAULT '',
[priority] [int] NOT NULL DEFAULT 100
) ON [PRIMARY]
";

$_SQL[] = "ALTER TABLE [dbo].[{$_TABLES['routes']}] ADD
CONSTRAINT [PK_{$_TABLES['routes']}] PRIMARY KEY CLUSTERED
(
[rid]
) ON [PRIMARY]
";

// Add sample routes to the table
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/stats', '/stats.php')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/topic/@topic', '/index.php?topic=@topic')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/page/@page', '/staticpages/index.php?page=@page')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/article/@sid', '/article.php?story=@sid')";

/**
* Add new config options
*
*/
function update_ConfValuesFor212()
{
global $_CONF;

require_once $_CONF['path_system'] . 'classes/config.class.php';

$c = config::get_instance();
$me = 'Core';
$c->add('url_routing',FALSE,'select',0,0,36,1850,TRUE, $me, 0);

return true;
}
34 changes: 34 additions & 0 deletions sql/updates/mysql_2.1.0_to_2.1.2.php
@@ -0,0 +1,34 @@
<?php

// Create "routes" table
$_SQL[] = "CREATE TABLE {$_TABLES['routes']} (
`rid` int(11) NOT NULL AUTO_INCREMENT,
`method` int(11) NOT NULL DEFAULT '1',
`rule` varchar(255) NOT NULL DEFAULT '',
`route` varchar(255) NOT NULL DEFAULT '',
`priority` int(11) NOT NULL DEFAULT '100',
PRIMARY KEY (`rid`)
)";

// Add sample routes to the table
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/stats', '/stats.php')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/topic/@topic', '/index.php?topic=@topic')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/page/@page', '/staticpages/index.php?page=@page')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/article/@sid', '/article.php?story=@sid')";

/**
* Add new config options
*
*/
function update_ConfValuesFor212()
{
global $_CONF;

require_once $_CONF['path_system'] . 'classes/config.class.php';

$c = config::get_instance();
$me = 'Core';
$c->add('url_routing',FALSE,'select',0,0,36,1850,TRUE, $me, 0);

return true;
}
34 changes: 34 additions & 0 deletions sql/updates/pgsql_2.1.0_to_2.1.2.php
@@ -0,0 +1,34 @@
<?php

// Create "routes" table
$_SQL[] = "CREATE TABLE {$_TABLES['routes']} (
rid SERIAL,
method int NOT NULL DEFAULT 1,
rule varchar(255) NOT NULL DEFAULT '',
route varchar(255) NOT NULL DEFAULT '',
priority int NOT NULL DEFAULT 100,
PRIMARY KEY (rid)
)";

// Add sample routes to the table
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/stats', '/stats.php')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/topic/@topic', '/index.php?topic=@topic')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/page/@page', '/staticpages/index.php?page=@page')";
$_SQL[] = "INSERT INTO {$_TABLES['routes']} (method, rule, route) VALUES (1, '/article/@sid', '/article.php?story=@sid')";

/**
* Add new config options
*
*/
function update_ConfValuesFor212()
{
global $_CONF;

require_once $_CONF['path_system'] . 'classes/config.class.php';

$c = config::get_instance();
$me = 'Core';
$c->add('url_routing',FALSE,'select',0,0,36,1850,TRUE, $me, 0);

return true;
}

0 comments on commit 14d5cbb

Please sign in to comment.