summaryrefslogtreecommitdiff
path: root/debian/maint-patches/007_database_update_php.diff
blob: d0c4275d8de0290057374f941d7c79ce370cce93 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
--- ../install/database_update.php	2013-09-28 14:36:35.462359564 -0400
+++ database_update_debian.php	2013-09-28 16:04:35.046507402 -0400
@@ -1,3 +1,4 @@
+#!/usr/bin/php5
 <?php
 /**
 *
@@ -34,7 +35,7 @@
 define('PHPBB_ROOT_PATH', '/usr/share/phpbb3/www/');
 
 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
-$phpEx = substr(strrchr(__FILE__, '.'), 1);
+$phpEx = 'php';
 
 if (!function_exists('phpbb_require_updated'))
 {
@@ -69,7 +70,7 @@
 
 if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type))
 {
-	die("Make sure you have a running board before trying to upgrade anything.");
+	exit(1);
 }
 
 // Load Extensions
@@ -165,7 +166,7 @@
 //set_error_handler('msg_handler');
 
 // Define some variables for the database update
-$inline_update = (request_var('type', 0)) ? true : false;
+$inline_update = true;
 
 // To let set_config() calls succeed, we need to make the config array available globally
 $config = array();
@@ -189,50 +190,11 @@
 $error_ary = array();
 $errored = false;
 
-header('Content-type: text/html; charset=UTF-8');
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>" xml:lang="<?php echo $lang['USER_LANG']; ?>">
-<head>
-
-<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
-<meta http-equiv="content-language" content="<?php echo $lang['USER_LANG']; ?>" />
-<meta http-equiv="content-style-type" content="text/css" />
-<meta http-equiv="imagetoolbar" content="no" />
-
-<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title>
-
-<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
-
-</head>
-
-<body>
-<div id="wrap">
-	<div id="page-header">&nbsp;</div>
-
-	<div id="page-body">
-		<div id="acp">
-		<div class="panel">
-			<span class="corners-top"><span></span></span>
-				<div id="content">
-					<div id="main" class="install-body">
-
-	<h1><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></h1>
-
-	<br />
-
-	<p><?php echo $lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->sql_layer; ?></strong><br />
-<?php
-
 if ($debug_from_version !== false)
 {
 	$config['version'] = $debug_from_version;
 }
 
-echo $lang['PREVIOUS_VERSION'] . ' :: <strong>' . $config['version'] . '</strong><br />';
-echo $lang['UPDATED_VERSION'] . ' :: <strong>' . $updates_to_version . '</strong></p>';
-
 $current_version = str_replace('rc', 'RC', strtolower($config['version']));
 $latest_version = str_replace('rc', 'RC', strtolower($updates_to_version));
 $orig_version = $config['version'];
@@ -243,79 +205,6 @@
 	set_config('dbms_version', $db->sql_server_info(true));
 }
 
-// Firebird update from Firebird 2.0 to 2.1+ required?
-if ($db->sql_layer == 'firebird')
-{
-	// We do not trust any PHP5 function enabled, we will simply test for a function new in 2.1
-	$db->sql_return_on_error(true);
-
-	$sql = 'SELECT 1 FROM RDB$DATABASE
-		WHERE BIN_AND(10, 1) = 0';
-	$result = $db->sql_query($sql);
-
-	if (!$result || $db->sql_error_triggered)
-	{
-		echo '<br /><br />';
-		echo '<h1>' . $lang['ERROR'] . '</h1><br />';
-
-		echo '<p>' . $lang['FIREBIRD_DBMS_UPDATE_REQUIRED'] . '</p>';
-
-		_print_footer();
-
-		exit_handler();
-		exit;
-	}
-
-	$db->sql_freeresult($result);
-	$db->sql_return_on_error(false);
-}
-
-// MySQL update from MySQL 3.x/4.x to > 4.1.x required?
-if ($db->sql_layer == 'mysql' || $db->sql_layer == 'mysql4' || $db->sql_layer == 'mysqli')
-{
-	// Verify by fetching column... if the column type matches the new type we update dbms_version...
-	$sql = "SHOW COLUMNS FROM " . CONFIG_TABLE;
-	$result = $db->sql_query($sql);
-
-	$column_type = '';
-	while ($row = $db->sql_fetchrow($result))
-	{
-		$field = strtolower($row['Field']);
-
-		if ($field == 'config_value')
-		{
-			$column_type = strtolower($row['Type']);
-			break;
-		}
-	}
-	$db->sql_freeresult($result);
-
-	// If column type is blob, but mysql version says we are on > 4.1.3, then the schema needs an update
-	if (strpos($column_type, 'blob') !== false && version_compare($db->sql_server_info(true), '4.1.3', '>='))
-	{
-		echo '<br /><br />';
-		echo '<h1>' . $lang['ERROR'] . '</h1><br />';
-
-		echo '<p>' . sprintf($lang['MYSQL_SCHEMA_UPDATE_REQUIRED'], $config['dbms_version'], $db->sql_server_info(true)) . '</p>';
-
-		_print_footer();
-
-		exit_handler();
-		exit;
-	}
-}
-
-// Now check if the user wants to update from a version we no longer support updates from
-if (version_compare($current_version, $oldest_from_version, '<'))
-{
-	echo '<br /><br /><h1>' . $lang['ERROR'] . '</h1><br />';
-	echo '<p>' . sprintf($lang['DB_UPDATE_NOT_SUPPORTED'], $oldest_from_version, $current_version) . '</p>';
-
-	_print_footer();
-	exit_handler();
-	exit;
-}
-
 // If the latest version and the current version are 'unequal', we will update the version_update_from, else we do not update anything.
 if ($inline_update)
 {
@@ -331,17 +220,6 @@
 }
 
 // Schema updates
-?>
-	<br /><br />
-
-	<h1><?php echo $lang['UPDATE_DATABASE_SCHEMA']; ?></h1>
-
-	<br />
-	<p><?php echo $lang['PROGRESS']; ?> :: <strong>
-
-<?php
-
-flush();
 
 // We go through the schema changes from the lowest to the highest version
 // We try to also include versions 'in-between'...
@@ -385,17 +263,6 @@
 $error_ary = array();
 $errored = $no_updates = false;
 
-?>
-
-<br /><br />
-<h1><?php echo $lang['UPDATING_DATA']; ?></h1>
-<br />
-<p><?php echo $lang['PROGRESS']; ?> :: <strong>
-
-<?php
-
-flush();
-
 $no_updates = true;
 $versions = array_keys($database_update_info);
 
@@ -419,17 +286,6 @@
 $error_ary = array();
 $errored = $no_updates = false;
 
-?>
-
-<br /><br />
-<h1><?php echo $lang['UPDATE_VERSION_OPTIMIZE']; ?></h1>
-<br />
-<p><?php echo $lang['PROGRESS']; ?> :: <strong>
-
-<?php
-
-flush();
-
 if ($debug_from_version === false)
 {
 	// update the version
@@ -468,43 +324,13 @@
 
 _write_result($no_updates, $errored, $error_ary);
 
-?>
-
-<br />
-<h1><?php echo $lang['UPDATE_COMPLETED']; ?></h1>
-
-<br />
-
-<?php
-
-if (!$inline_update)
-{
-?>
-
-	<p style="color:red"><?php echo $lang['UPDATE_FILES_NOTICE']; ?></p>
-
-	<p><?php echo $lang['COMPLETE_LOGIN_TO_BOARD']; ?></p>
-
-<?php
-}
-else
-{
-?>
-
-	<p><?php echo ((isset($lang['INLINE_UPDATE_SUCCESSFUL'])) ? $lang['INLINE_UPDATE_SUCCESSFUL'] : 'The database update was successful. Now you need to continue the update process.'); ?></p>
-
-	<p><a href="<?php echo append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode=update&amp;sub=file_check&amp;language=$language"); ?>" class="button1"><?php echo (isset($lang['CONTINUE_UPDATE_NOW'])) ? $lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p>
-
-<?php
-}
-
 // Add database update to log
 add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version);
 
 // Now we purge the session table as well as all cache files
 $cache->purge();
 
-_print_footer();
+//_print_footer();
 
 garbage_collection();
 
@@ -514,32 +340,9 @@
 }
 
 /**
-* Print out footer
-*/
-function _print_footer()
-{
-	echo <<<EOF
-					</div>
-				</div>
-			<span class="corners-bottom"><span></span></span>
-		</div>
-		</div>
-	</div>
-
-	<div id="page-footer">
-		Powered by <a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Group
-	</div>
-</div>
-
-</body>
-</html>
-EOF;
-}
-
-/**
 * Function for triggering an sql statement
 */
-function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
+function _sql($sql, &$errored, &$error_ary, $echo_dot = false)
 {
 	global $db;
 
@@ -582,6 +385,7 @@
 
 function _write_result($no_updates, $errored, $error_ary)
 {
+	return true;
 	global $lang;
 
 	if ($no_updates)