1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category backend
|
5
|
* @package installation
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
8
|
* @link http://www.websitebaker2.org/
|
9
|
* @license http://www.gnu.org/licenses/gpl.html
|
10
|
* @platform WebsiteBaker 2.8.x
|
11
|
* @requirements PHP 5.2.2 and higher
|
12
|
* @version $Id: upgrade-script.php 1768 2012-09-22 22:55:45Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/upgrade-script.php $
|
14
|
* @lastmodified $Date: 2012-09-23 00:55:45 +0200 (Sun, 23 Sep 2012) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
require_once('config.php');
|
19
|
|
20
|
require_once(WB_PATH.'/framework/functions.php');
|
21
|
require_once(WB_PATH.'/framework/class.admin.php');
|
22
|
// require_once(WB_PATH.'/framework/Database.php');
|
23
|
$admin = new admin('Addons', 'modules', false, false);
|
24
|
|
25
|
$oldVersion = 'Version '.WB_VERSION;
|
26
|
$oldVersion .= (defined('WB_SP') ? WB_SP : '');
|
27
|
$oldRevision = (defined('WB_REVISION') ? ' Revision ['.WB_REVISION.'] ' : '') ;
|
28
|
$newVersion = 'Version '.VERSION;
|
29
|
$newVersion .= (defined('SP') ? SP : '');
|
30
|
$newRevision = (defined('REVISION') ? ' Revision ['.REVISION.'] ' : '');
|
31
|
|
32
|
$bDebugModus = false;
|
33
|
|
34
|
// set addition settings if not exists, otherwise upgrade will be breaks
|
35
|
if(!defined('WB_SP')) { define('WB_SP',''); }
|
36
|
if(!defined('WB_REVISION')) { define('WB_REVISION',''); }
|
37
|
|
38
|
// database tables including in WB package
|
39
|
$aPackage = array (
|
40
|
'settings','groups','addons','pages','sections','search','users',
|
41
|
'mod_captcha_control','mod_code','mod_droplets','mod_form_fields',
|
42
|
'mod_form_settings','mod_form_submissions','mod_jsadmin','mod_menu_link',
|
43
|
'mod_news_comments','mod_news_groups','mod_news_posts','mod_news_settings',
|
44
|
'mod_output_filter','mod_wrapper','mod_wysiwyg'
|
45
|
);
|
46
|
|
47
|
$OK = ' <span class="ok">OK</span> ';
|
48
|
$FAIL = ' <span class="error">FAILED</span> ';
|
49
|
$DEFAULT_THEME = 'wb_theme';
|
50
|
|
51
|
$stepID = 0;
|
52
|
$aFilesToRemove = array();
|
53
|
$dirRemove = array(
|
54
|
/*
|
55
|
'[TEMPLATE]/allcss/',
|
56
|
'[TEMPLATE]/blank/',
|
57
|
'[TEMPLATE]/round/',
|
58
|
'[TEMPLATE]/simple/',
|
59
|
*/
|
60
|
'[ADMIN]/themes/',
|
61
|
);
|
62
|
|
63
|
if(version_compare(WB_REVISION, '1762', '<'))
|
64
|
{
|
65
|
$filesRemove['0'] = array(
|
66
|
|
67
|
'[ADMIN]/preferences/details.php',
|
68
|
'[ADMIN]/preferences/email.php',
|
69
|
'[ADMIN]/preferences/password.php',
|
70
|
'[ADMIN]/pages/settings2.php',
|
71
|
|
72
|
'[FRAMEWORK]/class.msg_queue.php',
|
73
|
'[FRAMEWORK]/class.logfile.php',
|
74
|
// '[FRAMEWORK]/class.database.php',
|
75
|
|
76
|
);
|
77
|
|
78
|
$filesRemove['1'] = array(
|
79
|
|
80
|
'[TEMPLATE]/argos_theme/templates/access.htt',
|
81
|
'[TEMPLATE]/argos_theme/templates/addons.htt',
|
82
|
'[TEMPLATE]/argos_theme/templates/admintools.htt',
|
83
|
'[TEMPLATE]/argos_theme/templates/error.htt',
|
84
|
'[TEMPLATE]/argos_theme/templates/groups.htt',
|
85
|
'[TEMPLATE]/argos_theme/templates/groups_form.htt',
|
86
|
'[TEMPLATE]/argos_theme/templates/languages.htt',
|
87
|
'[TEMPLATE]/argos_theme/templates/languages_details.htt',
|
88
|
/*
|
89
|
'[TEMPLATE]/argos_theme/templates/login.htt',
|
90
|
'[TEMPLATE]/argos_theme/templates/login_forgot.htt',
|
91
|
*/
|
92
|
'[TEMPLATE]/argos_theme/templates/media.htt',
|
93
|
'[TEMPLATE]/argos_theme/templates/media_browse.htt',
|
94
|
'[TEMPLATE]/argos_theme/templates/media_rename.htt',
|
95
|
'[TEMPLATE]/argos_theme/templates/modules.htt',
|
96
|
'[TEMPLATE]/argos_theme/templates/modules_details.htt',
|
97
|
'[TEMPLATE]/argos_theme/templates/pages.htt',
|
98
|
'[TEMPLATE]/argos_theme/templates/pages_modify.htt',
|
99
|
'[TEMPLATE]/argos_theme/templates/pages_sections.htt',
|
100
|
'[TEMPLATE]/argos_theme/templates/pages_settings.htt',
|
101
|
'[TEMPLATE]/argos_theme/templates/preferences.htt',
|
102
|
'[TEMPLATE]/argos_theme/templates/setparameter.htt',
|
103
|
'[TEMPLATE]/argos_theme/templates/settings.htt',
|
104
|
'[TEMPLATE]/argos_theme/templates/start.htt',
|
105
|
'[TEMPLATE]/argos_theme/templates/success.htt',
|
106
|
'[TEMPLATE]/argos_theme/templates/templates.htt',
|
107
|
'[TEMPLATE]/argos_theme/templates/templates_details.htt',
|
108
|
'[TEMPLATE]/argos_theme/templates/users.htt',
|
109
|
'[TEMPLATE]/argos_theme/templates/users_form.htt',
|
110
|
|
111
|
'[TEMPLATE]/wb_theme/templates/access.htt',
|
112
|
'[TEMPLATE]/wb_theme/templates/addons.htt',
|
113
|
'[TEMPLATE]/wb_theme/templates/admintools.htt',
|
114
|
'[TEMPLATE]/wb_theme/templates/error.htt',
|
115
|
'[TEMPLATE]/wb_theme/templates/groups.htt',
|
116
|
'[TEMPLATE]/wb_theme/templates/groups_form.htt',
|
117
|
'[TEMPLATE]/wb_theme/templates/languages.htt',
|
118
|
'[TEMPLATE]/wb_theme/templates/languages_details.htt',
|
119
|
|
120
|
/*
|
121
|
'[TEMPLATE]/wb_theme/templates/login.htt',
|
122
|
'[TEMPLATE]/wb_theme/templates/login_forgot.htt',
|
123
|
*/
|
124
|
|
125
|
'[TEMPLATE]/wb_theme/templates/media.htt',
|
126
|
'[TEMPLATE]/wb_theme/templates/media_browse.htt',
|
127
|
'[TEMPLATE]/wb_theme/templates/media_rename.htt',
|
128
|
'[TEMPLATE]/wb_theme/templates/modules.htt',
|
129
|
'[TEMPLATE]/wb_theme/templates/modules_details.htt',
|
130
|
'[TEMPLATE]/wb_theme/templates/pages.htt',
|
131
|
'[TEMPLATE]/wb_theme/templates/pages_modify.htt',
|
132
|
'[TEMPLATE]/wb_theme/templates/pages_sections.htt',
|
133
|
'[TEMPLATE]/wb_theme/templates/pages_settings.htt',
|
134
|
'[TEMPLATE]/wb_theme/templates/preferences.htt',
|
135
|
'[TEMPLATE]/wb_theme/templates/setparameter.htt',
|
136
|
'[TEMPLATE]/wb_theme/templates/settings.htt',
|
137
|
'[TEMPLATE]/wb_theme/templates/start.htt',
|
138
|
'[TEMPLATE]/wb_theme/templates/success.htt',
|
139
|
'[TEMPLATE]/wb_theme/templates/templates.htt',
|
140
|
'[TEMPLATE]/wb_theme/templates/templates_details.htt',
|
141
|
'[TEMPLATE]/wb_theme/templates/users.htt',
|
142
|
'[TEMPLATE]/wb_theme/templates/users_form.htt',
|
143
|
);
|
144
|
|
145
|
$aFilesToRemove = array_merge($filesRemove['0'],$filesRemove['1']);
|
146
|
|
147
|
}
|
148
|
|
149
|
/* display a status message on the screen **************************************
|
150
|
* @param string $message: the message to show
|
151
|
* @param string $class: kind of message as a css-class
|
152
|
* @param string $element: witch HTML-tag use to cover the message
|
153
|
* @return void
|
154
|
*/
|
155
|
function status_msg($message, $class='check', $element='div')
|
156
|
{
|
157
|
// returns a status message
|
158
|
$msg = '<'.$element.' class="'.$class.'">';
|
159
|
$msg .= '<strong>'.strtoupper(strtok($class, ' ')).'</strong>';
|
160
|
$msg .= $message.'</'.$element.'>';
|
161
|
echo $msg;
|
162
|
}
|
163
|
|
164
|
// analyze/check database tables
|
165
|
function mysqlCheckTables( $dbName )
|
166
|
{
|
167
|
global $aTable;
|
168
|
$table_prefix = TABLE_PREFIX;
|
169
|
$sql = "SHOW TABLES FROM " . $dbName;
|
170
|
$result = @mysql_query( $sql );
|
171
|
$data = array();
|
172
|
$x = 0;
|
173
|
|
174
|
while( ( $row = mysql_fetch_array( $result, MYSQL_NUM ) ) == true )
|
175
|
{
|
176
|
$tmp = str_replace($table_prefix, '', $row[0]);
|
177
|
|
178
|
if( stristr( $row[0], $table_prefix )&& in_array($tmp,$aTable) )
|
179
|
{
|
180
|
$sql = "CHECK TABLE " . $dbName . '.' . $row[0];
|
181
|
$analyze = mysql_query( $sql );
|
182
|
$rowFetch = mysql_fetch_array( $analyze, MYSQL_ASSOC );
|
183
|
$data[$x]['Op'] = $rowFetch["Op"];
|
184
|
$data[$x]['Msg_type'] = $rowFetch["Msg_type"];
|
185
|
$msgColor = '<span class="error">';
|
186
|
$data[$x]['Table'] = $row[0];
|
187
|
// print " ";
|
188
|
$msgColor = ($rowFetch["Msg_text"] == 'OK') ? '<span class="ok">' : '<span class="error">';
|
189
|
$data[$x]['Msg_text'] = $msgColor.$rowFetch["Msg_text"].'</span>';
|
190
|
// print "<br />";
|
191
|
$x++;
|
192
|
}
|
193
|
}
|
194
|
return $data;
|
195
|
}
|
196
|
|
197
|
// check existings tables for upgrade or install
|
198
|
function check_wb_tables()
|
199
|
{
|
200
|
global $database,$aPackage;
|
201
|
|
202
|
// if prefix inludes '_' or '%'
|
203
|
$search_for = addcslashes ( TABLE_PREFIX, '%_' );
|
204
|
$get_result = $database->query( 'SHOW TABLES LIKE "'.$search_for.'%"');
|
205
|
|
206
|
// $get_result = $database->query( "SHOW TABLES FROM ".DB_NAME);
|
207
|
$all_tables = array();
|
208
|
$aTable = array();
|
209
|
if($get_result->numRows() > 0)
|
210
|
{
|
211
|
while ($data = $get_result->fetchRow()) {
|
212
|
$tmp = str_replace(TABLE_PREFIX, '', $data[0]);
|
213
|
if(in_array($tmp,$aPackage)) {
|
214
|
$all_tables[] = $tmp;
|
215
|
} else {
|
216
|
$aTable[] = $tmp;
|
217
|
}
|
218
|
}
|
219
|
}
|
220
|
|
221
|
return array_merge ( $all_tables, $aTable );
|
222
|
}
|
223
|
|
224
|
// check existing tables
|
225
|
$all_tables = check_wb_tables();
|
226
|
|
227
|
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
228
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
229
|
<head>
|
230
|
<title>Upgrade script</title>
|
231
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
232
|
<style type="text/css">
|
233
|
html { overflow-y: scroll; /* Force firefox to always show room for a vertical scrollbar */ }
|
234
|
|
235
|
body {
|
236
|
margin:0;
|
237
|
padding:0;
|
238
|
border:0;
|
239
|
background: #EBF7FC;
|
240
|
color:#000;
|
241
|
font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
|
242
|
font-size: small;
|
243
|
height:101%;
|
244
|
}
|
245
|
|
246
|
#container {
|
247
|
min-width:48em;
|
248
|
width: 70%;
|
249
|
background: #A8BCCB url(templates/wb_theme/images/background.png) repeat-x;
|
250
|
border:1px solid #000;
|
251
|
color:#000;
|
252
|
margin:2em auto;
|
253
|
padding:0 20px;
|
254
|
min-height: 500px;
|
255
|
text-align:left;
|
256
|
}
|
257
|
.page {
|
258
|
width:100%;
|
259
|
overflow: hidden;
|
260
|
}
|
261
|
.content {
|
262
|
padding: 10px;
|
263
|
}
|
264
|
p { line-height:1.5em; }
|
265
|
|
266
|
form {
|
267
|
display: inline-block;
|
268
|
line-height: 20px;
|
269
|
vertical-align: baseline;
|
270
|
}
|
271
|
input[type="submit"].restart {
|
272
|
background-color: #FFDBDB;
|
273
|
font-weight: bold;
|
274
|
}
|
275
|
|
276
|
h1,h2,h3,h4,h5,h6 {
|
277
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
278
|
color: #26527D;
|
279
|
margin-top: 1.0em;
|
280
|
margin-bottom: 0.1em;
|
281
|
}
|
282
|
|
283
|
h1 { font-size:150%; }
|
284
|
h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
|
285
|
h3 { font-size: 110%; font-weight: bold; }
|
286
|
|
287
|
textarea {
|
288
|
width:100%;
|
289
|
border: 2px groove #0F1D44;
|
290
|
padding: 2px;
|
291
|
color: #000;
|
292
|
font-weight: normal;
|
293
|
}
|
294
|
.ok, .error { font-weight:bold; }
|
295
|
.ok { color:green; }
|
296
|
.error { color:red; }
|
297
|
.check { color:#555; }
|
298
|
|
299
|
span.ok,
|
300
|
span.error {
|
301
|
margin-left: 0em;
|
302
|
}
|
303
|
|
304
|
.warning {
|
305
|
background:#FFDBDB;
|
306
|
padding:1em;
|
307
|
margin-top:0.5em;
|
308
|
border: 1px solid #DB0909;
|
309
|
}
|
310
|
.info {
|
311
|
background:#C7F4C7;
|
312
|
padding:1em;
|
313
|
margin-top:0.5em;
|
314
|
border: 1px solid #277A29;
|
315
|
}
|
316
|
|
317
|
</style>
|
318
|
</head>
|
319
|
<body>
|
320
|
<div id="container">
|
321
|
<div class="page">
|
322
|
<img src="templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
|
323
|
<div class="content">
|
324
|
<h1>WebsiteBaker Upgrade</h1>
|
325
|
<?php
|
326
|
if( version_compare( WB_VERSION, '2.7', '<' )) {
|
327
|
status_msg('<strong>Warning:</strong><br />It is not possible to upgrade from WebsiteBaker Versions before 2.7.<br />For upgrading to version '.VERSION.' you must upgrade first to v.2.7 at least!!!', 'warning', 'div');
|
328
|
echo '<br /><br />';
|
329
|
echo "</div>
|
330
|
</div>
|
331
|
</div>
|
332
|
</body>
|
333
|
</html>
|
334
|
";
|
335
|
exit();
|
336
|
}
|
337
|
|
338
|
?>
|
339
|
<p class="info">This script upgrades an existing WebsiteBaker <strong> <?php echo $oldRevision; ?></strong> installation to the <strong> <?php echo $newRevision ?> </strong>.<br />The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p>
|
340
|
|
341
|
<?php
|
342
|
/**
|
343
|
* Check if disclaimer was accepted
|
344
|
*/
|
345
|
$bDebugModus = false;
|
346
|
$bDebugModus = ( (isset($_POST['debug_confirmed']) && $_POST['debug_confirmed'] == 'debug') ? true : false);
|
347
|
if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
|
348
|
<h2>Step 1: Backup your files</h2>
|
349
|
<p>It is highly recommended to <strong>create a manual backup</strong> of the entire <strong><?php echo PAGES_DIRECTORY ?>/ folder</strong> and the <strong>MySQL database</strong> before proceeding.<br /><strong class="error">Note: </strong>The upgrade script alters some settings of your existing database!!! You need to confirm the disclaimer before proceeding.</p>
|
350
|
|
351
|
<form name="send" action="<?php echo $_SERVER['SCRIPT_NAME'];?>" method="post">
|
352
|
<textarea cols="92" rows="5">DISCLAIMER: The WebsiteBaker upgrade script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. One needs to confirm that a manual backup of the <?php echo PAGES_DIRECTORY ?>/ folder (including all files and subfolders contained in it) and backup of the entire WebsiteBaker MySQL database was created before you can proceed.</textarea>
|
353
|
<br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" /> <strong>I confirm that a manual backup of the <?php echo PAGES_DIRECTORY ?>/ folder and the MySQL database was created.</strong>
|
354
|
<br /><br /><input name="debug_confirmed" type="checkbox" value="debug" /> <strong>Here you can get more details during running upgrade.</strong>
|
355
|
<br /><br /><input name="send" type="submit" value="Start upgrade script" />
|
356
|
</form>
|
357
|
<br />
|
358
|
|
359
|
<?php
|
360
|
status_msg('<strong> Notice:</strong><br />You need to confirm that you have created a manual backup of the '.PAGES_DIRECTORY.'/ directory and the MySQL database before you can proceed.', 'warning', 'div');
|
361
|
echo '<br /><br />';
|
362
|
echo "</div>
|
363
|
</div>
|
364
|
</div>
|
365
|
</body>
|
366
|
</html>
|
367
|
";
|
368
|
exit();
|
369
|
}
|
370
|
|
371
|
// check again all tables, to get a new array
|
372
|
// if(sizeof($all_tables) < sizeof($aTable)) { $all_tables = check_wb_tables(); }
|
373
|
/**********************************************************
|
374
|
* - check tables coming with WebsiteBaker
|
375
|
*/
|
376
|
$check_text = 'total ';
|
377
|
// $check_tables = mysqlCheckTables( DB_NAME ) ;
|
378
|
$aTable = array();
|
379
|
foreach ($all_tables as $data) {
|
380
|
$tmp = str_replace(TABLE_PREFIX, '', $data);
|
381
|
if(in_array($tmp,$aPackage)) {
|
382
|
$aTable[] = $tmp;
|
383
|
}
|
384
|
}
|
385
|
|
386
|
if( (sizeof($all_tables) >= sizeof($aPackage)) && (sizeof($aTable) == sizeof($aPackage)) )
|
387
|
{
|
388
|
echo '<h4 style="margin-left:0;">NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($aPackage).' included in package '.$OK.'</h4>';
|
389
|
}
|
390
|
else
|
391
|
{
|
392
|
status_msg('<strong>:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
|
393
|
echo '<h4>Missing required tables. You can install them in backend->addons->modules.<br />';
|
394
|
echo 'Or if you uploaded per FTP install possible by backend->addons->modules->advanced.<br />';
|
395
|
echo 'After installingT again run upgrade-script.php</h4>';
|
396
|
$result = array_diff ( $aPackage, $aTable );
|
397
|
|
398
|
echo '<h4 class="warning"><br />';
|
399
|
while ( list ( $key, $val ) = each ( $result ) )
|
400
|
{
|
401
|
echo 'TABLE ´'.TABLE_PREFIX.$val.'´ '.$FAIL.'<br>';
|
402
|
}
|
403
|
|
404
|
echo '<br /></h4>';
|
405
|
echo '<br /><br />';
|
406
|
if(isset($_SERVER['SCRIPT_NAME'])) {
|
407
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'/">';
|
408
|
echo ' <input type="submit" value="Start upgrade again" />';
|
409
|
echo '</form>';
|
410
|
}
|
411
|
if(defined('ADMIN_URL')) {
|
412
|
echo '<form action="'.ADMIN_URL.'/">';
|
413
|
echo ' <input type="submit" value="kick me to the Backend" />';
|
414
|
echo '</form>';
|
415
|
}
|
416
|
|
417
|
echo "<br /><br /></div>
|
418
|
</div>
|
419
|
</div>
|
420
|
</body>
|
421
|
</html>
|
422
|
";
|
423
|
|
424
|
exit();
|
425
|
}
|
426
|
|
427
|
echo '<h3>Step '.(++$stepID).': Setting default_theme</h3>';
|
428
|
$aDebugMessage = array();
|
429
|
/**********************************************************
|
430
|
* - Adding field default_theme to settings table
|
431
|
*/
|
432
|
$aDebugMessage[] = '<div style="margin-left:2em;">';
|
433
|
$aDebugMessage[] = "<br /><span><strong>Adding default_theme to settings table</strong></span>";
|
434
|
// db_update_key_value('settings', 'default_theme', $DEFAULT_THEME);
|
435
|
$aDebugMessage[] = (db_update_key_value( 'settings', 'default_theme', $DEFAULT_THEME ) ? " $OK<br />" : " $FAIL!<br />");
|
436
|
$aDebugMessage[] = '</div>';
|
437
|
|
438
|
if($bDebugModus) {
|
439
|
echo implode(PHP_EOL,$aDebugMessage);
|
440
|
}
|
441
|
$aDebugMessage = array();
|
442
|
echo'<h3>Step '.(++$stepID).': Updating core tables</h3>';
|
443
|
/**********************************************************
|
444
|
* - Adding field sec_anchor to settings table
|
445
|
*/
|
446
|
echo '<div style="margin-left:2em;">';
|
447
|
echo "<h4>Adding/updating entries on table settings</h4>";
|
448
|
$aDebugMessage[] = "<span>Adding/updating sec_anchor to settings table</span>";
|
449
|
$cfg = array(
|
450
|
'sec_anchor' => defined('SEC_ANCHOR') ? SEC_ANCHOR : 'section_'
|
451
|
);
|
452
|
|
453
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
454
|
|
455
|
|
456
|
/**********************************************************
|
457
|
* - Adding redirect timer to settings table
|
458
|
*/
|
459
|
$aDebugMessage[] = "<span>Adding/updating redirect timer to settings table</span>";
|
460
|
$cfg = array(
|
461
|
'redirect_timer' => defined('REDIRECT_TIMER') ? REDIRECT_TIMER : '1500'
|
462
|
);
|
463
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
464
|
|
465
|
/**********************************************************
|
466
|
* - Adding rename_files_on_upload to settings table
|
467
|
*/
|
468
|
$aDebugMessage[] = "<span>Adding/Updating rename_files_on_upload to settings table</span>";
|
469
|
$cfg = array(
|
470
|
'rename_files_on_upload' => (defined('RENAME_FILES_ON_UPLOAD') ? RENAME_FILES_ON_UPLOAD : 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js')
|
471
|
);
|
472
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
473
|
|
474
|
/**********************************************************
|
475
|
* - Adding mediasettings to settings table
|
476
|
*/
|
477
|
$aDebugMessage[] = "<span>Adding/updating mediasettings to settings table</span>";
|
478
|
$cfg = array(
|
479
|
'mediasettings' => (defined('MEDIASETTINGS') ? MEDIASETTINGS : ''),
|
480
|
);
|
481
|
|
482
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
483
|
|
484
|
/**********************************************************
|
485
|
* - Adding fingerprint_with_ip_octets to settings table
|
486
|
*/
|
487
|
$aDebugMessage[] = "<span>Adding/updating fingerprint_with_ip_octets to settings table</span>";
|
488
|
$cfg = array(
|
489
|
'fingerprint_with_ip_octets' => (defined('FINGERPRINT_WITH_IP_OCTETS') ? FINGERPRINT_WITH_IP_OCTETS : '2'),
|
490
|
'secure_form_module' => (defined('SECURE_FORM_MODULE') ? SECURE_FORM_MODULE : '')
|
491
|
);
|
492
|
|
493
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
494
|
|
495
|
/**********************************************************
|
496
|
* - Adding page_icon_dir to settings table
|
497
|
*/
|
498
|
$aDebugMessage[] = "<span>Adding/updating page_icon_dir to settings table</span>";
|
499
|
$cfg = array(
|
500
|
'page_icon_dir' => (defined('PAGE_ICON_DIR') ? PAGE_ICON_DIR : '/templates/*/title_images'),
|
501
|
);
|
502
|
|
503
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
504
|
/**********************************************************
|
505
|
* - Adding page_extended to settings table
|
506
|
*/
|
507
|
$aDebugMessage[] = "<span>Adding/updating page_extended to settings table</span>";
|
508
|
$cfg = array(
|
509
|
'page_extended' => (defined('PAGE_EXTENDED') ? PAGE_EXTENDED : 'true'),
|
510
|
);
|
511
|
|
512
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
513
|
|
514
|
/**********************************************************
|
515
|
* - Adding website_signature to settings table
|
516
|
*/
|
517
|
$aDebugMessage[] = "<span>Adding/updating website_signature to settings table</span>";
|
518
|
$cfg = array(
|
519
|
'website_signature' => (defined('WEBSITE_SIGNATURE') && (WEBSITE_SIGNATURE=='') ? '' : WEBSITE_SIGNATURE)
|
520
|
);
|
521
|
|
522
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
523
|
|
524
|
/**********************************************************
|
525
|
* - Adding confirmed_registration to settings table
|
526
|
*/
|
527
|
$aDebugMessage[] = "<span>Adding/updating confirmed_registration to settings table</span>";
|
528
|
$cfg = array(
|
529
|
'confirmed_registration' => (defined('CONFIRMED_REGISTRATION') && (CONFIRMED_REGISTRATION=='') ? '' : CONFIRMED_REGISTRATION)
|
530
|
);
|
531
|
|
532
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
533
|
|
534
|
/**********************************************************
|
535
|
* - Adding dev_infos to settings table
|
536
|
*/
|
537
|
$aDebugMessage[] = "<span>Adding/updating dev_infos to settings table</span>";
|
538
|
$cfg = array(
|
539
|
'dev_infos' => (defined('DEV_INFOS') ? DEV_INFOS : 'false')
|
540
|
);
|
541
|
|
542
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
543
|
|
544
|
/**********************************************************
|
545
|
* - Adding dev_infos to settings table
|
546
|
*/
|
547
|
$aDebugMessage[] = "<span>Adding/updating modules_upgrade_list to settings table</span>";
|
548
|
$cfg = array(
|
549
|
'modules_upgrade_list' => (defined('MODULES_UPGRADE_LIST') ? MODULES_UPGRADE_LIST : 'news')
|
550
|
);
|
551
|
|
552
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
553
|
|
554
|
|
555
|
if($bDebugModus) {
|
556
|
echo implode(PHP_EOL,$aDebugMessage);
|
557
|
}
|
558
|
echo '</div>';
|
559
|
|
560
|
$aDebugMessage = array();
|
561
|
if(version_compare(WB_REVISION, REVISION, '<'))
|
562
|
{
|
563
|
echo '<div style="margin-left:2em;">';
|
564
|
/**********************************************************
|
565
|
* - Update search no results database filed to create
|
566
|
* valid XHTML if search is empty
|
567
|
*/
|
568
|
if (version_compare(WB_VERSION, '2.8', '<'))
|
569
|
{
|
570
|
echo "<h4>Adding/updating fields on table search</h4>";
|
571
|
echo "Updating database field `no_results` on search table: ";
|
572
|
$search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
|
573
|
$sql = 'UPDATE `'.TABLE_PREFIX.'search` ';
|
574
|
$sql .= 'SET `value`=\''.$search_no_results.'\' ';
|
575
|
$sql .= 'WHERE `name`=\'no_results\'';
|
576
|
echo ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />";
|
577
|
}
|
578
|
|
579
|
echo "<h4>Adding/updating fiekds on table mod_menu_link</h4>";
|
580
|
/**********************************************************
|
581
|
* - Add field "redirect_type" to table "mod_menu_link"
|
582
|
* has to be moved later to upgrade.php in modul menu_link, because modul can be removed
|
583
|
*/
|
584
|
$table_name = TABLE_PREFIX.'mod_menu_link';
|
585
|
$field_name = 'redirect_type';
|
586
|
$description = "INT NOT NULL DEFAULT '301' AFTER `target_page_id`";
|
587
|
if(!$database->field_exists($table_name,$field_name)) {
|
588
|
echo "<span>Adding field redirect_type to mod_menu_link table</span>";
|
589
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
590
|
} else {
|
591
|
echo "<span>Modify field redirect_type to mod_menu_link table</span>";
|
592
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
593
|
}
|
594
|
|
595
|
echo "<h4>Adding/updating fiekds on table pages</h4>";
|
596
|
/**********************************************************
|
597
|
* - Add field "page_trail" to table "pages"
|
598
|
*/
|
599
|
$table_name = TABLE_PREFIX.'pages';
|
600
|
$field_name = 'page_trail';
|
601
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''";
|
602
|
echo "<span>Modify field page_trail to pages table</span>";
|
603
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
604
|
|
605
|
/**********************************************************
|
606
|
* - Add field "page_icon" to table "pages"
|
607
|
*/
|
608
|
$table_name = TABLE_PREFIX.'pages';
|
609
|
$field_name = 'page_icon';
|
610
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_title`";
|
611
|
if(!$database->field_exists($table_name,$field_name)) {
|
612
|
echo "<span>Adding field page_icon to pages table</span>";
|
613
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
614
|
} else {
|
615
|
echo "<span>Modify field page_icon to pages table</span>";
|
616
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
617
|
}
|
618
|
|
619
|
/**********************************************************
|
620
|
* - Add field "page_code" to table "pages"
|
621
|
*/
|
622
|
$table_name = TABLE_PREFIX.'pages';
|
623
|
$field_name = 'page_code';
|
624
|
$description = "INT NOT NULL DEFAULT '0' AFTER `language`";
|
625
|
if(!$database->field_exists($table_name,$field_name)) {
|
626
|
echo "<span>Adding field page_code to pages table</span>";
|
627
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
628
|
} else {
|
629
|
echo "<span>Modify field page_code to pages table</span>";
|
630
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
631
|
}
|
632
|
|
633
|
/**********************************************************
|
634
|
* - Add field "menu_icon_0" to table "pages"
|
635
|
*/
|
636
|
$table_name = TABLE_PREFIX.'pages';
|
637
|
$field_name = 'menu_icon_0';
|
638
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_title`";
|
639
|
if(!$database->field_exists($table_name,$field_name)) {
|
640
|
echo "<span>Adding field menu_icon_0 to pages table</span>";
|
641
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
642
|
} else {
|
643
|
echo "<span>Modify field menu_icon_0 to pages table</span>";
|
644
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
645
|
}
|
646
|
|
647
|
/**********************************************************
|
648
|
* - Add field "menu_icon_1" to table "pages"
|
649
|
*/
|
650
|
$table_name = TABLE_PREFIX.'pages';
|
651
|
$field_name = 'menu_icon_1';
|
652
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_0`";
|
653
|
if(!$database->field_exists($table_name,$field_name)) {
|
654
|
echo "<span>Adding field menu_icon_1 to pages table</span>";
|
655
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
656
|
} else {
|
657
|
echo "<span>Modify field menu_icon_1 to pages table</span>";
|
658
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
659
|
}
|
660
|
|
661
|
/**********************************************************
|
662
|
* - Add field "tooltip" to table "pages"
|
663
|
*/
|
664
|
$table_name = TABLE_PREFIX.'pages';
|
665
|
$field_name = 'tooltip';
|
666
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_1`";
|
667
|
if(!$database->field_exists($table_name,$field_name)) {
|
668
|
echo "<span>Adding field tooltip to pages table</span>";
|
669
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
670
|
} else {
|
671
|
echo "<span>Modify field tooltip to pages table";
|
672
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
673
|
}
|
674
|
|
675
|
/**********************************************************
|
676
|
* - Add field "admin_groups" to table "pages"
|
677
|
*/
|
678
|
$table_name = TABLE_PREFIX.'pages';
|
679
|
$field_name = 'admin_groups';
|
680
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
|
681
|
echo "<span>Modify field admin_groups to pages table";
|
682
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
683
|
|
684
|
/**********************************************************
|
685
|
* - Add field "admin_users" to table "pages"
|
686
|
*/
|
687
|
$table_name = TABLE_PREFIX.'pages';
|
688
|
$field_name = 'admin_users';
|
689
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
|
690
|
echo "<span>Modify field admin_users to pages table</span>";
|
691
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
692
|
|
693
|
/**********************************************************
|
694
|
* - Add field "viewing_groups" to table "pages"
|
695
|
*/
|
696
|
$table_name = TABLE_PREFIX.'pages';
|
697
|
$field_name = 'viewing_groups';
|
698
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
|
699
|
echo "<span>Modify field viewing_groups to pages table</span>";
|
700
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
701
|
|
702
|
/**********************************************************
|
703
|
* - Add field "viewing_users" to table "pages"
|
704
|
*/
|
705
|
$table_name = TABLE_PREFIX.'pages';
|
706
|
$field_name = 'viewing_users';
|
707
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
|
708
|
echo "<span>Modify field viewing_users to pages table";
|
709
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
710
|
|
711
|
/**********************************************************
|
712
|
* - Add field "custom01" to table "pages"
|
713
|
*/
|
714
|
$table_name = TABLE_PREFIX.'pages';
|
715
|
$field_name = 'custom01';
|
716
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT '' ";
|
717
|
if(!$database->field_exists($table_name,$field_name)) {
|
718
|
echo "<span>Adding field custom01 to pages table</span>";
|
719
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
720
|
} else {
|
721
|
echo "<span>Modify field custom01 to pages table</span>";
|
722
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
723
|
}
|
724
|
|
725
|
/**********************************************************
|
726
|
* - Add field "custom02" to table "pages"
|
727
|
*/
|
728
|
$table_name = TABLE_PREFIX.'pages';
|
729
|
$field_name = 'custom02';
|
730
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT '' ";
|
731
|
if(!$database->field_exists($table_name,$field_name)) {
|
732
|
echo "<span>Adding field custom02 to pages table</span>";
|
733
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
734
|
} else {
|
735
|
echo "<span>Modify field custom02 to pages table</span>";
|
736
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
737
|
}
|
738
|
|
739
|
/**********************************************************
|
740
|
* modify wrong strucre on table sections
|
741
|
* wrong structure let crash wb
|
742
|
*/
|
743
|
echo "<h4>Change field structure on table sections</h4>";
|
744
|
$table_name = TABLE_PREFIX.'sections';
|
745
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''";
|
746
|
echo "<span>Modify field module on sections table</span>";
|
747
|
echo ($database->field_modify($table_name, 'module', $description) ? " $OK<br />" : " $FAIL!<br />");
|
748
|
echo "<span>Modify field block on sections table</span>";
|
749
|
echo ($database->field_modify($table_name, 'block', $description) ? " $OK<br />" : " $FAIL!<br />");
|
750
|
echo "<span>Modify field publ_start on sections table</span>";
|
751
|
echo ($database->field_modify($table_name, 'publ_start', $description) ? " $OK<br />" : " $FAIL!<br />");
|
752
|
echo "<span>Modify field publ_end on sections table</span>";
|
753
|
echo ($database->field_modify($table_name, 'publ_end', $description) ? " $OK<br />" : " $FAIL!<br />");
|
754
|
|
755
|
echo '</div>';
|
756
|
|
757
|
}
|
758
|
|
759
|
if($bDebugModus) {
|
760
|
echo implode(PHP_EOL,$aDebugMessage);
|
761
|
}
|
762
|
$aDebugMessage = array();
|
763
|
/**********************************************************
|
764
|
* This part with changing in mod_wysiwyg will be removed in the final version
|
765
|
* special workout for the tester
|
766
|
* - Remove/add PRIMARY KEY from/to "section_id" from table "mod_wysiwygs"
|
767
|
*/
|
768
|
$aDebugMessage[] = '<div style="margin-left:2em;">';
|
769
|
|
770
|
$sTable = TABLE_PREFIX.'mod_wysiwyg';
|
771
|
$field_name = 'wysiwyg_id';
|
772
|
if($database->field_exists($sTable, 'wysiwyg_id')) {
|
773
|
if($database->index_exists($sTable, 'PRIMARY')) {
|
774
|
$aDebugMessage[] = "<span>Remove PRIMARY KEY from table mod_wysiwyg.wysiwyg_id</span>";
|
775
|
$aDebugMessage[] = $database->index_remove($sTable, 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />";
|
776
|
}
|
777
|
$aDebugMessage[] = "<span>Remove field 'wysiwyg_id' from table mod_wysiwyg</span>";
|
778
|
$aDebugMessage[] = $database->field_remove($sTable, 'wysiwyg_id') ? " $OK<br />" : " $FAIL!<br />";
|
779
|
}
|
780
|
|
781
|
$aDebugMessage[] = "<br /><span>Create PRIMARY KEY ( `section_id` ) on table mod_wysiwygs.</span>";
|
782
|
$aDebugMessage[] = $database->index_add($sTable, '', 'section_id', 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />";
|
783
|
$aDebugMessage[] = '</div>';
|
784
|
|
785
|
if($bDebugModus) {
|
786
|
// $aDebugMessage[] =
|
787
|
echo implode(PHP_EOL,$aDebugMessage);
|
788
|
}
|
789
|
$aDebugMessage = array();
|
790
|
|
791
|
echo '<h3>Step '.(++$stepID).': Updating acess and protected files in folders</h3>';
|
792
|
|
793
|
echo '<div style="margin-left:2em;">';
|
794
|
/**********************************************************
|
795
|
* upgrade media directory index protect files
|
796
|
*/
|
797
|
$dir = (WB_PATH.MEDIA_DIRECTORY);
|
798
|
echo '<h4>Upgrade media directory '.MEDIA_DIRECTORY.'/ index.php protect files</h4>';
|
799
|
$array = rebuildFolderProtectFile($dir);
|
800
|
if( sizeof( $array ) ){
|
801
|
print '<span><strong>Upgrade '.sizeof( $array ).' directory '.MEDIA_DIRECTORY.'/ protect files</strong></span>'." $OK<br />";
|
802
|
} else {
|
803
|
print '<span><strong>Upgrade directory '.MEDIA_DIRECTORY.'/ protect files</strong></span>'." $FAIL!<br />";
|
804
|
print implode ('<br />',$array);
|
805
|
}
|
806
|
|
807
|
/**********************************************************
|
808
|
* upgrade pages directory index access files
|
809
|
*/
|
810
|
echo '<h4>Upgrade pages directory '.PAGES_DIRECTORY.'/ protect and access files</h4>';
|
811
|
|
812
|
/**********************************************************
|
813
|
* - Reformat/rebuild all existing access files
|
814
|
*/
|
815
|
$sPagePath = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '');
|
816
|
$msg = rebuild_all_accessfiles();
|
817
|
|
818
|
print implode ('<br />',$msg);
|
819
|
echo '</div>';
|
820
|
/* *****************************************************************************
|
821
|
* - check for deprecated / never needed files
|
822
|
*/
|
823
|
if(sizeof($aFilesToRemove)) {
|
824
|
echo '<h3>Step '.(++$stepID).': Remove deprecated and old files</h3>';
|
825
|
$searches = array(
|
826
|
'[ADMIN]',
|
827
|
'[MEDIA]',
|
828
|
'[PAGES]',
|
829
|
'[FRAMEWORK]',
|
830
|
'[MODULES]',
|
831
|
'[TEMPLATE]'
|
832
|
);
|
833
|
$replacements = array(
|
834
|
'/'.substr(ADMIN_PATH, strlen(WB_PATH)+1),
|
835
|
MEDIA_DIRECTORY,
|
836
|
PAGES_DIRECTORY,
|
837
|
'/framework',
|
838
|
'/modules',
|
839
|
'/templates'
|
840
|
);
|
841
|
|
842
|
$msg = '';
|
843
|
foreach( $aFilesToRemove as $file )
|
844
|
{
|
845
|
$file = str_replace($searches, $replacements, $file);
|
846
|
if( is_writable(WB_PATH.'/'.$file) ) {
|
847
|
// try to unlink file
|
848
|
if(!unlink(WB_PATH.$file)) {
|
849
|
// save in err-list, if failed
|
850
|
$msg .= $file.'<br />';
|
851
|
} else {
|
852
|
$msg .= $file.'<br />';
|
853
|
}
|
854
|
}
|
855
|
}
|
856
|
|
857
|
if($msg != '')
|
858
|
{
|
859
|
$msg = '<br /><br />Following files are deprecated, outdated or a security risk and
|
860
|
can not be removed automatically.<br /><br />Please delete them
|
861
|
using FTP and restart upgrade-script!<br /><br />'.$msg.'<br />';
|
862
|
status_msg($msg, 'error warning', 'div');
|
863
|
echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>';
|
864
|
|
865
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
|
866
|
echo ' <input name="send" type="submit" value="Restart upgrade script" />';
|
867
|
echo '</form>';
|
868
|
echo "<br /><br /></div>
|
869
|
</div>
|
870
|
</div>
|
871
|
</body>
|
872
|
</html>
|
873
|
";
|
874
|
exit;
|
875
|
}
|
876
|
}
|
877
|
|
878
|
|
879
|
/**********************************************************
|
880
|
* - check for deprecated / never needed files
|
881
|
*/
|
882
|
if(sizeof($dirRemove)) {
|
883
|
echo '<h3>Step '.(++$stepID).': Remove deprecated and old folders</h3>';
|
884
|
$searches = array(
|
885
|
'[ADMIN]',
|
886
|
'[MEDIA]',
|
887
|
'[PAGES]',
|
888
|
'[TEMPLATE]'
|
889
|
);
|
890
|
$replacements = array(
|
891
|
substr(ADMIN_PATH, strlen(WB_PATH)+1),
|
892
|
MEDIA_DIRECTORY,
|
893
|
PAGES_DIRECTORY,
|
894
|
'/templates',
|
895
|
);
|
896
|
$msg = '';
|
897
|
foreach( $dirRemove as $dir ) {
|
898
|
$dir = str_replace($searches, $replacements, $dir);
|
899
|
$dir = WB_PATH.'/'.$dir;
|
900
|
if( is_dir( $dir )) {
|
901
|
// try to delete dir
|
902
|
if(!is_writable( $dir ) || !rm_full_dir($dir)) {
|
903
|
// save in err-list, if failed
|
904
|
$msg .= str_replace(WB_PATH,'',$dir).'<br />';
|
905
|
}
|
906
|
}
|
907
|
}
|
908
|
|
909
|
if($msg != '') {
|
910
|
$msg = '<br /><br />Following directories are deprecated, outdated or a security risk and
|
911
|
can not be removed automatically.<br /><br />Please delete them
|
912
|
using FTP and restart upgrade-script!<br /><br />'.$msg.'<br />';
|
913
|
status_msg($msg, 'error warning', 'div');
|
914
|
echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>';
|
915
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
|
916
|
echo ' <input name="send" type="submit" value="Restart upgrade script" />';
|
917
|
echo '</form>';
|
918
|
echo "<br /><br /></div>
|
919
|
</div>
|
920
|
</div>
|
921
|
</body>
|
922
|
</html>
|
923
|
";
|
924
|
exit;
|
925
|
}
|
926
|
}
|
927
|
|
928
|
/**********************************************************
|
929
|
* upgrade modules if newer version is available
|
930
|
* $aModuleList list of proofed modules
|
931
|
*/
|
932
|
$sModuleList = 'news,wysiwyg,form';
|
933
|
$aModuleList = explode(',', (defined('MODULES_UPGRADE_LIST') ? MODULES_UPGRADE_LIST : $sModuleList));
|
934
|
echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
|
935
|
// $aModuleList = array('news');
|
936
|
foreach($aModuleList as $sModul) {
|
937
|
if(file_exists(WB_PATH.'/modules/'.$sModul.'/upgrade.php')) {
|
938
|
$currModulVersion = get_modul_version ($sModul, false);
|
939
|
$newModulVersion = get_modul_version ($sModul, true);
|
940
|
if((version_compare($currModulVersion, $newModulVersion) <= 0)) {
|
941
|
echo '<div style="margin-left:2em;">';
|
942
|
echo '<h4>'.'Upgrade module \''.$sModul.'\' version '.$newModulVersion.'</h4>';
|
943
|
require_once(WB_PATH.'/modules/'.$sModul.'/upgrade.php');
|
944
|
echo '</div>';
|
945
|
}
|
946
|
}
|
947
|
}
|
948
|
|
949
|
/**********************************************************
|
950
|
* - Reload all addons
|
951
|
*/
|
952
|
|
953
|
echo '<h3>Step '.(++$stepID).' : Reload all addons database entry (no upgrade)</h3><br />';
|
954
|
echo '<div style="margin-left:2em;">';
|
955
|
$iFound = 0;
|
956
|
$iLoaded = 0;
|
957
|
////delete modules
|
958
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
|
959
|
// Load all modules
|
960
|
if( ($handle = opendir(WB_PATH.'/modules/')) ) {
|
961
|
while(false !== ($file = readdir($handle))) {
|
962
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
|
963
|
$iFound++;
|
964
|
$iLoaded = load_module(WB_PATH.'/modules/'.$file ) ? $iLoaded+1 : $iLoaded;
|
965
|
// upgrade_module($file, true);
|
966
|
}
|
967
|
}
|
968
|
closedir($handle);
|
969
|
}
|
970
|
echo '<span><strong>'.$iLoaded.' Modules reloaded,</span> found '.$iFound.' directories in folder /modules/</strong><br />';
|
971
|
|
972
|
$iFound = 0;
|
973
|
$iLoaded = 0;
|
974
|
////delete templates
|
975
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
|
976
|
// Load all templates
|
977
|
if( ($handle = opendir(WB_PATH.'/templates/')) ) {
|
978
|
while(false !== ($file = readdir($handle))) {
|
979
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
980
|
$iFound++;
|
981
|
$iLoaded = (load_template(WB_PATH.'/templates/'.$file)==true) ? $iLoaded+1 : $iLoaded;
|
982
|
}
|
983
|
}
|
984
|
closedir($handle);
|
985
|
}
|
986
|
echo '<span><strong>'.$iLoaded.' Templates reloaded,</span> found '.$iFound.' directories in folder /templates/</strong><br />';
|
987
|
|
988
|
$iFound = 0;
|
989
|
$iLoaded = 0;
|
990
|
////delete languages
|
991
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
|
992
|
// Load all languages
|
993
|
if( ($handle = opendir(WB_PATH.'/languages/')) ) {
|
994
|
while(false !== ($file = readdir($handle))) {
|
995
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
996
|
$iFound++;
|
997
|
$iLoaded = load_language(WB_PATH.'/languages/'.$file) ? $iLoaded+1 : $iLoaded;
|
998
|
}
|
999
|
}
|
1000
|
closedir($handle);
|
1001
|
}
|
1002
|
echo '<span><strong>'.$iLoaded.' Languages reloaded,</span> found '.$iFound.' files in folder /languages/</strong><br />';
|
1003
|
echo '</div>';
|
1004
|
|
1005
|
/**********************************************************
|
1006
|
* - install new droplets
|
1007
|
$drops = (!in_array ( "mod_droplets", $all_tables)) ? "<br />Install droplets<br />" : "<br />Upgrade droplets<br />";
|
1008
|
echo $drops;
|
1009
|
$file_name = (!in_array ( "mod_droplets", $all_tables) ? "install.php" : "upgrade.php");
|
1010
|
require_once (WB_PATH."/modules/droplets/".$file_name);
|
1011
|
********************************************************** */
|
1012
|
|
1013
|
/**********************************************************
|
1014
|
* - End of upgrade script
|
1015
|
*/
|
1016
|
if(!defined('DEFAULT_THEME')) { define('DEFAULT_THEME', $DEFAULT_THEME); }
|
1017
|
if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);}
|
1018
|
/**********************************************************
|
1019
|
* - Set Version to new Version
|
1020
|
*/
|
1021
|
echo '<h3>Step '.(++$stepID).': Update database version number </h3>';
|
1022
|
echo '<div style="margin-left:2em;">';
|
1023
|
|
1024
|
$cfg = array(
|
1025
|
'wb_version' => VERSION,
|
1026
|
'wb_revision' => REVISION,
|
1027
|
'wb_sp' => SP
|
1028
|
);
|
1029
|
echo '<br /><span><strong>Set database version number to '.VERSION.' '.SP.' '.' Revision ['.REVISION.'] : </strong></span>';
|
1030
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
1031
|
echo '</div>';
|
1032
|
|
1033
|
echo '<p style="font-size:140%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
|
1034
|
status_msg('<strong>:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
|
1035
|
// show buttons to go to the backend or frontend
|
1036
|
echo '<br />';
|
1037
|
|
1038
|
if(defined('WB_URL')) {
|
1039
|
echo '<form action="'.WB_URL.'/">';
|
1040
|
echo ' <input type="submit" value="kick me to the Frontend" />';
|
1041
|
echo '</form>';
|
1042
|
}
|
1043
|
if(defined('ADMIN_URL')) {
|
1044
|
echo '<form action="'.ADMIN_URL.'/">';
|
1045
|
echo ' <input type="submit" value="kick me to the Backend" />';
|
1046
|
echo '</form>';
|
1047
|
}
|
1048
|
|
1049
|
echo "<br /><br /></div>
|
1050
|
</div>
|
1051
|
</div>
|
1052
|
</body>
|
1053
|
</html>
|
1054
|
";
|
1055
|
exit();
|