aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop/convert_conf.php
diff options
context:
space:
mode:
authorBart van Bragt <bartvb@users.sourceforge.net>2001-09-08 18:24:34 +0000
committerBart van Bragt <bartvb@users.sourceforge.net>2001-09-08 18:24:34 +0000
commit9b64a5d50cc491d4a8d256104db865463119c7bc (patch)
tree2a603b95d0d6b9e1682311d0aca97b7759c1cbeb /phpBB/develop/convert_conf.php
parent19ae53a5b142e946da042eef2209dba6893ce09a (diff)
downloadforums-9b64a5d50cc491d4a8d256104db865463119c7bc.tar
forums-9b64a5d50cc491d4a8d256104db865463119c7bc.tar.gz
forums-9b64a5d50cc491d4a8d256104db865463119c7bc.tar.bz2
forums-9b64a5d50cc491d4a8d256104db865463119c7bc.tar.xz
forums-9b64a5d50cc491d4a8d256104db865463119c7bc.zip
Altered layout of phpbb_config table
git-svn-id: file:///svn/phpbb/trunk@1010 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/develop/convert_conf.php')
-rw-r--r--phpBB/develop/convert_conf.php96
1 files changed, 96 insertions, 0 deletions
diff --git a/phpBB/develop/convert_conf.php b/phpBB/develop/convert_conf.php
new file mode 100644
index 0000000000..3e7fb0d606
--- /dev/null
+++ b/phpBB/develop/convert_conf.php
@@ -0,0 +1,96 @@
+<?
+
+$phpbb_root_path = "../";
+
+include($phpbb_root_path . 'extension.inc');
+include($phpbb_root_path . 'config.'.$phpEx);
+include($phpbb_root_path . 'includes/constants.'.$phpEx);
+include($phpbb_root_path . 'includes/db.'.$phpEx);
+
+$sql = "SELECT *
+ FROM " . CONFIG_TABLE;
+if(!$result = $db->sql_query($sql))
+{
+ message_die(CRITICAL_ERROR, "Could not query config information", "", __LINE__, __FILE__, $sql);
+}
+else
+{
+ $board_config = $db->sql_fetchrow($result);
+}
+
+$newconfigtable = $table_prefix . "newconfig";
+
+$sql = "SELECT config_name, config_value FROM ". CONFIG_TABLE;
+if( $result = $db->sql_query($sql) )
+{
+ die("Don't run this script twice!<br>\n");
+}
+
+$sql = " CREATE TABLE $newconfigtable (
+ config_name varchar(255) NOT NULL,
+ config_value varchar(255) NOT NULL,
+ PRIMARY KEY (config_name)
+ )";
+print "Creating temporary table: $newconfigtable<p>\n";
+if( !$result = $db->sql_query($sql) )
+{
+ print("Couldn't create new config table<br>\n");
+}
+
+$error = 0;
+while (list($name, $value) = each($board_config))
+{
+ if(is_int($name))
+ {
+ // Skip numeric array elements (we only want the associative array)
+ continue;
+ }
+
+ // Rename sys_template
+ if ($name == 'sys_template')
+ {
+ $name = 'board_template';
+ }
+ // Rename system_timezone
+ if ($name == 'system_timezone')
+ {
+ $name = 'board_timezone';
+ }
+ print "$name = $value<br>\n";
+ $value = addslashes($value);
+ $sql = "INSERT INTO $newconfigtable (config_name, config_value) VALUES ('$name', '$value')";
+ if( !$result = $db->sql_query($sql) )
+ {
+ print("Couldn't insert '$name' into new config table");
+ $error = 1;
+ }
+}
+
+if ($error != 1)
+{
+ print "Dropping old table<p>\n";
+ $sql = "DROP TABLE ". CONFIG_TABLE;
+ if( !$result = $db->sql_query($sql) )
+ {
+ die("Couldn't drop old table");
+ }
+ print "Renaming $newconfigtable to ".CONFIG_TABLE."<p>\n";
+ $sql = "ALTER TABLE $newconfigtable RENAME ".CONFIG_TABLE;
+ if( !$result = $db->sql_query($sql) )
+ {
+ die("Couldn't rename new config table");
+ }
+ print "Renaming ".SESSIONS_TABLE." to ".$table_prefix."sessions<br>\n";
+ $sql = "ALTER TABLE ".SESSIONS_TABLE." RENAME ".$table_prefix."sessions";
+ if( !$result = $db->sql_query($sql) )
+ {
+ die("Couldn't rename session table");
+ }
+
+}
+
+$db->sql_close();
+
+ echo "<BR><BR>COMPLETE<BR>";
+
+?>