blob: 09c71e8c03225fe16446875de8d57d8b1e54dca7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
<?php
//
// Security message:
//
// This script is potentially dangerous.
// Remove or comment the next line (die(".... ) to enable this script.
// Do NOT FORGET to either remove this script or disable it after you have used it.
//
die("Please read the first lines of this script for instructions on how to enable it");
//
// Do not change anything below this line.
//
$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>";
?>
|