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