Project

General

Profile

« Previous | Next » 

Revision 1765

Added by Dietmar about 12 years ago

! recoded module news,form,wysiwyg upgrade to work with upgrade-script

View differences:

upgrade-script.php
29 29
$newVersion .= (defined('SP') ? SP : '');
30 30
$newRevision = (defined('REVISION') ? ' Revision ['.REVISION.'] ' : '');
31 31

  
32
$bDebugModus = false;
33

  
32 34
// set addition settings if not exists, otherwise upgrade will be breaks
33 35
if(!defined('WB_SP')) { define('WB_SP',''); }
34 36
if(!defined('WB_REVISION')) { define('WB_REVISION',''); }
35 37

  
36 38
// database tables including in WB package
37
$aTable = array (
39
$aPackage = array (
38 40
    'settings','groups','addons','pages','sections','search','users',
39 41
    'mod_captcha_control','mod_code','mod_droplets','mod_form_fields',
40 42
    'mod_form_settings','mod_form_submissions','mod_jsadmin','mod_menu_link',
......
47 49
$DEFAULT_THEME = 'wb_theme';
48 50

  
49 51
$stepID = 0;
52
$aFilesToRemove = array();
50 53
$dirRemove = array(
51 54
/*
52 55
			'[TEMPLATE]/allcss/',
......
57 60
			'[ADMIN]/themes/',
58 61
		 );
59 62

  
60
$filesRemove['0'] = array(
63
if(version_compare(WB_REVISION, '1762', '<'))
64
{
65
    $filesRemove['0'] = array(
61 66

  
62 67
			'[ADMIN]/preferences/details.php',
63 68
			'[ADMIN]/preferences/email.php',
......
70 75

  
71 76
		 );
72 77

  
73
if(version_compare(WB_REVISION, '1681', '<'))
74
{
75 78
	$filesRemove['1'] = array(
76 79

  
77 80
			'[TEMPLATE]/argos_theme/templates/access.htt',
......
138 141
			'[TEMPLATE]/wb_theme/templates/users.htt',
139 142
			'[TEMPLATE]/wb_theme/templates/users_form.htt',
140 143
		 );
144

  
145
    $aFilesToRemove = array_merge($filesRemove['0'],$filesRemove['1']);
146

  
141 147
}
142 148

  
143 149
/* display a status message on the screen **************************************
......
146 152
 * @param string $element: witch HTML-tag use to cover the message
147 153
 * @return void
148 154
 */
149
function status_msg($message, $class='check', $element='span')
155
function status_msg($message, $class='check', $element='div')
150 156
{
151 157
	// returns a status message
152 158
	$msg  = '<'.$element.' class="'.$class.'">';
......
191 197
// check existings tables for upgrade or install
192 198
function check_wb_tables()
193 199
{
194
    global $database,$aTable;
200
    global $database,$aPackage;
195 201

  
196
 // if prefix inludes '_' or '%'
197
 $search_for = addcslashes ( TABLE_PREFIX, '%_' );
198
 $get_result = $database->query( 'SHOW TABLES LIKE "'.$search_for.'%"');
202
// if prefix inludes '_' or '%'
203
    $search_for = addcslashes ( TABLE_PREFIX, '%_' );
204
    $get_result = $database->query( 'SHOW TABLES LIKE "'.$search_for.'%"');
199 205

  
200
        // $get_result = $database->query( "SHOW TABLES FROM ".DB_NAME);
201
        $all_tables = array();
202
        if($get_result->numRows() > 0)
203
        {
204
            while ($data = $get_result->fetchRow())
205
            {
206
                $tmp = str_replace(TABLE_PREFIX, '', $data[0]);
207
                if(in_array($tmp,$aTable))
208
                {
209
                    $all_tables[] = $tmp;
210
                }
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;
211 217
            }
212 218
        }
213
     return $all_tables;
219
    }
220

  
221
    return array_merge ( $all_tables, $aTable );
214 222
}
215 223

  
216 224
// check existing tables
......
236 244
}
237 245

  
238 246
#container {
239
	width:85%;
247
	min-width:48em;
248
    width: 70%;
240 249
	background: #A8BCCB url(templates/wb_theme/images/background.png) repeat-x;
241 250
	border:1px solid #000;
242 251
	color:#000;
243 252
	margin:2em auto;
244
	padding:0 15px;
253
	padding:0 20px;
245 254
	min-height: 500px;
246 255
	text-align:left;
247 256
}
248

  
257
.page {
258
	width:100%;
259
    overflow: hidden;
260
}
261
.content {
262
    padding: 10px;
263
}
249 264
p { line-height:1.5em; }
250 265

  
251 266
form {
......
260 275

  
261 276
h1,h2,h3,h4,h5,h6 {
262 277
	font-family: Verdana, Arial, Helvetica, sans-serif;
263
	color: #369;
278
	color: #26527D;
264 279
	margin-top: 1.0em;
265 280
	margin-bottom: 0.1em;
266 281
}
267 282

  
268 283
h1 { font-size:150%; }
269 284
h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
270
h3 { font-size: 110%; font-weight: bold;; }
285
h3 { font-size: 110%; font-weight: bold; }
271 286

  
287
textarea {
288
	width:100%;
289
    border: 2px groove #0F1D44;
290
    padding: 2px;
291
    color: #000;
292
    font-weight: normal;
293
}
272 294
.ok, .error { font-weight:bold; }
273 295
.ok { color:green; }
274 296
.error { color:red; }
275 297
.check { color:#555; }
276 298

  
299
span.ok,
300
span.error {
301
    margin-left: 0em;
302
}
303

  
277 304
.warning {
278
	width: 98%;
279 305
	background:#FFDBDB;
280
	padding:0.2em;
306
	padding:1em;
281 307
	margin-top:0.5em;
282
	border: 1px solid black;
308
	border: 1px solid #DB0909;
283 309
}
284 310
.info {
285
	width: 98%;
286
	background:#99CC99;
287
	padding:0.2em;
311
	background:#C7F4C7;
312
	padding:1em;
288 313
	margin-top:0.5em;
289
	border: 1px solid black;
314
	border: 1px solid #277A29;
290 315
}
291 316

  
292 317
</style>
293 318
</head>
294 319
<body>
295 320
<div id="container">
321
<div class="page">
296 322
<img src="templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
323
<div class="content">
297 324
<h1>WebsiteBaker Upgrade</h1>
298 325
<?php
299 326
	if( version_compare( WB_VERSION, '2.7', '<' )) {
300 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');
301 328
		echo '<br /><br />';
302 329
		echo "</div>
330
        </div>
331
        </div>
303 332
		</body>
304 333
		</html>
305 334
		";
......
307 336
	}
308 337

  
309 338
?>
310
<p>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>
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>
311 340

  
312 341
<?php
313 342
/**
314 343
 * Check if disclaimer was accepted
315 344
 */
345
$bDebugModus = false;
346
$bDebugModus = ( (isset($_POST['debug_confirmed']) && $_POST['debug_confirmed'] == 'debug') ? true : false);
316 347
if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
317 348
<h2>Step 1: Backup your files</h2>
318
<p>It is highly recommended to <strong>create a manual backup</strong> of the entire <strong>/pages 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>
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>
319 350

  
320 351
<form name="send" action="<?php echo $_SERVER['SCRIPT_NAME'];?>" method="post">
321
<textarea cols="80" 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 /pages folder (including all files and subfolders contained in it) and backup of the entire WebsiteBaker MySQL database was created before you can proceed.</textarea>
322
<br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" />&nbsp;I confirm that a manual backup of the /pages folder and the MySQL database was created.
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" />&nbsp;<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" />&nbsp;<strong>Here you can get more details during running upgrade.</strong>
323 355
<br /><br /><input name="send" type="submit" value="Start upgrade script" />
324 356
</form>
325 357
<br />
326 358

  
327 359
<?php
328
	status_msg('<strong>Notice:</strong><br />You need to confirm that you have created a manual backup of the /pages directory and the MySQL database before you can proceed.', 'warning', 'div');
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');
329 361
	echo '<br /><br />';
330 362
    echo "</div>
363
    </div>
364
    </div>
331 365
    </body>
332 366
    </html>
333 367
    ";
334 368
	exit();
335 369
}
336 370

  
337
echo '<h3>Step '.(++$stepID).': Setting default_theme</h3>';
338

  
339
/**********************************************************
340
 *  - Adding field default_theme to settings table
341
 */
342
echo "<br />Adding default_theme to settings table";
343
// db_update_key_value('settings', 'default_theme', $DEFAULT_THEME);
344
echo (db_update_key_value( 'settings', 'default_theme', $DEFAULT_THEME ) ? " $OK<br />" : " $FAIL!<br />");
345

  
346 371
// check again all tables, to get a new array
347
 if(sizeof($all_tables) < 22) { $all_tables = check_wb_tables(); }
372
// if(sizeof($all_tables) < sizeof($aTable)) { $all_tables = check_wb_tables(); }
348 373
/**********************************************************
349
 *  - check tables comin with WebsiteBaker
374
 *  - check tables coming with WebsiteBaker
350 375
 */
351 376
    $check_text = 'total ';
352 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
    }
353 385

  
354
    if(sizeof($all_tables) == 22)
386
    if( (sizeof($all_tables) >= sizeof($aPackage)) && (sizeof($aTable) == sizeof($aPackage)) )
355 387
    {
356
        echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($aTable).' included in package '.$OK.'</h4>';
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>';
357 389
    }
358 390
    else
359 391
    {
360
        status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
361
    	echo '<h4>Missing required tables. You can install them in backend->addons->modules->advanced. Then again run upgrade-script.php</h4>';
362
        $result = array_diff ( $aTable, $all_tables );
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

  
363 398
        echo '<h4 class="warning"><br />';
364 399
        while ( list ( $key, $val ) = each ( $result ) )
365 400
        {
366
            echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
401
            echo 'TABLE ´'.TABLE_PREFIX.$val.'´ '.$FAIL.'<br>';
367 402
        }
403

  
368 404
        echo '<br /></h4>';
369
    	echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
370
    	echo '<input type="submit" value="kick me back" style="float:left;" />';
371
    	echo '</form>';
372
        if(defined('ADMIN_URL'))
373
        {
374
        	echo '<form action="'.ADMIN_URL.'" target="_self">';
405
        echo '<br /><br />';
406
        if(isset($_SERVER['SCRIPT_NAME'])) {
407
        	echo '<form action="'.$_SERVER['SCRIPT_NAME'].'/">';
408
        	echo '&nbsp;<input type="submit" value="Start upgrade again" />';
409
        	echo '</form>';
410
        }
411
        if(defined('ADMIN_URL')) {
412
        	echo '<form action="'.ADMIN_URL.'/">';
375 413
        	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
376 414
        	echo '</form>';
377 415
        }
416

  
378 417
        echo "<br /><br /></div>
418
        </div>
419
        </div>
379 420
        </body>
380 421
        </html>
381 422
        ";
423

  
382 424
        exit();
383 425
    }
384 426

  
427
echo '<h3>Step '.(++$stepID).': Setting default_theme</h3>';
385 428

  
386
echo '<h3>Step '.(++$stepID).': Updating settings</h3>';
387
/**********************************************************
388
 *  - Adding field sec_anchor to settings table
389
 */
390
echo "<br />Adding/updating sec_anchor to settings table";
391
$cfg = array(
392
	'sec_anchor' => defined('SEC_ANCHOR') ? SEC_ANCHOR : 'wb_'
393
);
429
if($bDebugModus) {
430
    /**********************************************************
431
     *  - Adding field default_theme to settings table
432
     */
433
    echo '<div style="margin-left:2em;">';
434
    echo "<br /><span><strong>Adding default_theme to settings table</strong></span>";
435
    // db_update_key_value('settings', 'default_theme', $DEFAULT_THEME);
436
    echo (db_update_key_value( 'settings', 'default_theme', $DEFAULT_THEME ) ? " $OK<br />" : " $FAIL!<br />");
437
    echo '</div>';
394 438

  
395
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
439
}
440
    echo '<h3>Step '.(++$stepID).': Updating core tables</h3>';
396 441

  
442
if($bDebugModus) {
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
    echo "<span>Adding/updating sec_anchor to settings table</span>";
449
    $cfg = array(
450
    	'sec_anchor' => defined('SEC_ANCHOR') ? SEC_ANCHOR : 'section_'
451
    );
397 452

  
398
/**********************************************************
399
 *  - Adding redirect timer to settings table
400
 */
401
echo "Adding/updating redirect timer to settings table";
402
$cfg = array(
403
	'redirect_timer' => defined('REDIRECT_TIMER') ? REDIRECT_TIMER : '1500'
404
);
405
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
453
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
406 454

  
407
/**********************************************************
408
 *  - Adding rename_files_on_upload to settings table
409
 */
410
echo "Adding/Updating rename_files_on_upload to settings table";
411
$cfg = array(
412
	'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')
413
);
414
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
415 455

  
416
/**********************************************************
417
 *  - Adding mediasettings to settings table
418
 */
419
echo "Adding/updating mediasettings to settings table";
420
$cfg = array(
421
	'mediasettings' => (defined('MEDIASETTINGS') ? MEDIASETTINGS : ''),
422
);
456
    /**********************************************************
457
     *  - Adding redirect timer to settings table
458
     */
459
    echo "<span>Adding/updating redirect timer to settings table</span>";
460
    $cfg = array(
461
    	'redirect_timer' => defined('REDIRECT_TIMER') ? REDIRECT_TIMER : '1500'
462
    );
463
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
423 464

  
424
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
465
    /**********************************************************
466
     *  - Adding rename_files_on_upload to settings table
467
     */
468
    echo "<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
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
425 473

  
426
/**********************************************************
427
 *  - Adding fingerprint_with_ip_octets to settings table
428
 */
429
echo "Adding/updating fingerprint_with_ip_octets to settings table";
430
$cfg = array(
431
	'fingerprint_with_ip_octets' => (defined('FINGERPRINT_WITH_IP_OCTETS') ? FINGERPRINT_WITH_IP_OCTETS : '2'),
432
	'secure_form_module' => (defined('SECURE_FORM_MODULE') ? SECURE_FORM_MODULE : '')
433
);
474
    /**********************************************************
475
     *  - Adding mediasettings to settings table
476
     */
477
    echo "<span>Adding/updating mediasettings to settings table</span>";
478
    $cfg = array(
479
    	'mediasettings' => (defined('MEDIASETTINGS') ? MEDIASETTINGS : ''),
480
    );
434 481

  
435
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
482
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
436 483

  
437
/**********************************************************
438
 *  - Adding page_icon_dir to settings table
439
 */
440
echo "Adding/updating page_icon_dir to settings table";
441
$cfg = array(
442
	'page_icon_dir' => (defined('PAGE_ICON_DIR') ? PAGE_ICON_DIR : '/templates/*/title_images'),
443
);
484
    /**********************************************************
485
     *  - Adding fingerprint_with_ip_octets to settings table
486
     */
487
    echo "<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
    );
444 492

  
445
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
446
/**********************************************************
447
 *  - Adding page_extended to settings table
448
 */
449
echo "Adding/updating page_extended to settings table";
450
$cfg = array(
451
	'page_extended' => (defined('PAGE_EXTENDED') ? PAGE_EXTENDED : 'true'),
452
);
493
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
453 494

  
454
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
495
    /**********************************************************
496
     *  - Adding page_icon_dir to settings table
497
     */
498
    echo "<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
    );
455 502

  
456
/**********************************************************
457
 *  - Adding sec_anchor to settings table
458
 */
459
echo "Adding/updating sec_anchor to settings table";
460
$cfg = array(
461
	'sec_anchor' => (defined('SEC_ANCHOR') && (SEC_ANCHOR=='') ? 'section_' : SEC_ANCHOR)
462
);
503
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
504
    /**********************************************************
505
     *  - Adding page_extended to settings table
506
     */
507
    echo "<span>Adding/updating page_extended to settings table</span>";
508
    $cfg = array(
509
    	'page_extended' => (defined('PAGE_EXTENDED') ? PAGE_EXTENDED : 'true'),
510
    );
463 511

  
464
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
465
/**********************************************************
466
 *  - Adding dev_infos to settings table
467
 */
468
echo "Adding/updating dev_infos to settings table";
469
$cfg = array(
470
	'dev_infos' => (defined('DEV_INFOS') ? DEV_INFOS : 'false')
471
);
512
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
472 513

  
473
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
514
    /**********************************************************
515
     *  - Adding website_signature to settings table
516
     */
517
    echo "<span>Adding/updating website_signature to settings table</span>";
518
    $cfg = array(
519
    	'website_signature' => (defined('WEBSITE_SIGNATURE') && (WEBSITE_SIGNATURE=='') ? '' : WEBSITE_SIGNATURE)
520
    );
474 521

  
522
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
523

  
524
    /**********************************************************
525
     *  - Adding confirmed_registration to settings table
526
     */
527
    echo "<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
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
533

  
534
    /**********************************************************
535
     *  - Adding dev_infos to settings table
536
     */
537
    echo "<span>Adding/updating dev_infos to settings table</span>";
538
    $cfg = array(
539
    	'dev_infos' => (defined('DEV_INFOS') ? DEV_INFOS : 'false')
540
    );
541

  
542
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
543

  
544
    /**********************************************************
545
     *  - Adding dev_infos to settings table
546
     */
547
    echo "<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
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
553

  
554
    echo '</div>';
555

  
556

  
557
}
558

  
475 559
if(version_compare(WB_REVISION, REVISION, '<'))
476 560
{
477
	echo '<h3>Step '.(++$stepID).': Updating core tables</h3>';
478

  
561
    echo '<div style="margin-left:2em;">';
479 562
	/**********************************************************
480 563
	 *  - Update search no results database filed to create
481 564
	 *  valid XHTML if search is empty
482 565
	 */
483 566
	if (version_compare(WB_VERSION, '2.8', '<'))
484 567
	{
485
	    echo "<br />Updating database field `no_results` of search table: ";
568
        echo "<h4>Adding/updating fields on table search</h4>";
569
	    echo "Updating database field `no_results` on search table: ";
486 570
	    $search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
487 571
	    $sql  = 'UPDATE `'.TABLE_PREFIX.'search` ';
488 572
		$sql .= 'SET `value`=\''.$search_no_results.'\' ';
489 573
		$sql .= 'WHERE `name`=\'no_results\'';
490
	    echo ($database->query($sql)) ? ' $OK<br />' : ' $FAIL<br />';
574
	    echo ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />";
491 575
	}
492 576

  
577
    echo "<h4>Adding/updating fiekds on table mod_menu_link</h4>";
493 578
	/**********************************************************
494 579
     *  - Add field "redirect_type" to table "mod_menu_link"
495 580
     *  has to be moved later to upgrade.php in modul menu_link, because modul can be removed
......
498 583
	$field_name = 'redirect_type';
499 584
	$description = "INT NOT NULL DEFAULT '301' AFTER `target_page_id`";
500 585
	if(!$database->field_exists($table_name,$field_name)) {
501
		echo "<br />Adding field redirect_type to mod_menu_link table";
586
		echo "<span>Adding field redirect_type to mod_menu_link table</span>";
502 587
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
503 588
	} else {
504
		echo "<br />Modify field redirect_type to mod_menu_link table";
589
		echo "<span>Modify field redirect_type to mod_menu_link table</span>";
505 590
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
506 591
	}
507 592

  
593
    echo "<h4>Adding/updating fiekds on table pages</h4>";
508 594
	/**********************************************************
509 595
	 *  - Add field "page_trail" to table "pages"
510 596
	 */
511 597
	$table_name = TABLE_PREFIX.'pages';
512 598
	$field_name = 'page_trail';
513 599
	$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''";
514
	echo "Modify field page_trail to pages table";
600
	echo "<span>Modify field page_trail to pages table</span>";
515 601
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
516 602

  
517 603
	/**********************************************************
......
521 607
	$field_name = 'page_icon';
522 608
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_title`";
523 609
	if(!$database->field_exists($table_name,$field_name)) {
524
		echo "Adding field page_icon to pages table";
610
		echo "<span>Adding field page_icon to pages table</span>";
525 611
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
526 612
	} else {
527
		echo "Modify field page_icon to pages table";
613
		echo "<span>Modify field page_icon to pages table</span>";
528 614
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
529 615
	}
530 616

  
......
535 621
	$field_name = 'page_code';
536 622
	$description = "INT NOT NULL DEFAULT '0' AFTER `language`";
537 623
	if(!$database->field_exists($table_name,$field_name)) {
538
		echo "Adding field page_code to pages table";
624
		echo "<span>Adding field page_code to pages table</span>";
539 625
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
540 626
	} else {
541
		echo "Modify field page_code to pages table";
627
		echo "<span>Modify field page_code to pages table</span>";
542 628
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
543 629
	}
544 630

  
......
549 635
	$field_name = 'menu_icon_0';
550 636
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_title`";
551 637
	if(!$database->field_exists($table_name,$field_name)) {
552
		echo "Adding field menu_icon_0 to pages table";
638
		echo "<span>Adding field menu_icon_0 to pages table</span>";
553 639
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
554 640
	} else {
555
		echo "Modify field menu_icon_0 to pages table";
641
		echo "<span>Modify field menu_icon_0 to pages table</span>";
556 642
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
557 643
	}
558 644

  
......
563 649
	$field_name = 'menu_icon_1';
564 650
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_0`";
565 651
	if(!$database->field_exists($table_name,$field_name)) {
566
		echo "Adding field menu_icon_1 to pages table";
652
		echo "<span>Adding field menu_icon_1 to pages table</span>";
567 653
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
568 654
	} else {
569
		echo "Modify field menu_icon_1 to pages table";
655
		echo "<span>Modify field menu_icon_1 to pages table</span>";
570 656
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
571 657
	}
572 658

  
......
577 663
	$field_name = 'tooltip';
578 664
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_1`";
579 665
	if(!$database->field_exists($table_name,$field_name)) {
580
		echo "Adding field tooltip to pages table";
666
		echo "<span>Adding field tooltip to pages table</span>";
581 667
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
582 668
	} else {
583
		echo "Modify field tooltip to pages table";
669
		echo "<span>Modify field tooltip to pages table";
584 670
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
585 671
	}
586 672

  
......
590 676
	$table_name = TABLE_PREFIX.'pages';
591 677
	$field_name = 'admin_groups';
592 678
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
593
	echo "Modify field admin_groups to pages table";
679
	echo "<span>Modify field admin_groups to pages table";
594 680
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
595 681

  
596 682
	/**********************************************************
......
599 685
	$table_name = TABLE_PREFIX.'pages';
600 686
	$field_name = 'admin_users';
601 687
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
602
	echo "Modify field admin_users to pages table";
688
	echo "<span>Modify field admin_users to pages table</span>";
603 689
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
604 690

  
605 691
	/**********************************************************
......
608 694
	$table_name = TABLE_PREFIX.'pages';
609 695
	$field_name = 'viewing_groups';
610 696
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
611
	echo "Modify field viewing_groups to pages table";
697
	echo "<span>Modify field viewing_groups to pages table</span>";
612 698
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
613 699

  
614 700
	/**********************************************************
......
617 703
	$table_name = TABLE_PREFIX.'pages';
618 704
	$field_name = 'viewing_users';
619 705
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
620
	echo "Modify field viewing_users to pages table";
706
	echo "<span>Modify field viewing_users to pages table";
621 707
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
622 708

  
623 709

  
624
/**
625
 * This part with changing in mod_wysiwyg will be removed in the final version
626
 * special workout for the tester
627
 */
628
	/**********************************************************
629
	 *  - Remove/add PRIMARY KEY from/to "section_id" from table "mod_wysiwygs"
630
	 */
631
	$sTable = TABLE_PREFIX.'mod_wysiwyg';
632
	$field_name = 'wysiwyg_id';
633
	if($database->field_exists($sTable,$field_name)) {
634
    	echo "Remove PRIMARY KEY from table mod_wysiwygs";
635
//ALTER TABLE `wb283_mod_wysiwyg` DROP `wysiwyg_id`
636
        $sql = 'ALTER TABLE `'.DB_NAME.'`.`'.$sTable.'` DROP `wysiwyg_id`';
637
        echo ($database->query($sql) ? " $OK<br />" : " $FAIL!<br />");
710
    /**********************************************************
711
     * modify wrong strucre on table sections
712
     * wrong structure let crash wb
713
     */
714
	echo "<h4>Change field structure on table sections</h4>";
715
	$table_name = TABLE_PREFIX.'sections';
716
	$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''";
717
	echo "<span>Modify field module on sections table</span>";
718
	echo ($database->field_modify($table_name, 'module', $description) ? " $OK<br />" : " $FAIL!<br />");
719
	echo "<span>Modify field block on sections table</span>";
720
	echo ($database->field_modify($table_name, 'block', $description) ? " $OK<br />" : " $FAIL!<br />");
721
	echo "<span>Modify field publ_start on sections table</span>";
722
	echo ($database->field_modify($table_name, 'publ_start', $description) ? " $OK<br />" : " $FAIL!<br />");
723
	echo "<span>Modify field publ_end on sections table</span>";
724
	echo ($database->field_modify($table_name, 'publ_end', $description) ? " $OK<br />" : " $FAIL!<br />");
638 725

  
639
//    	echo "add new PRIMARY KEY to table mod_wysiwygs";
640
//        $sql = 'ALTER TABLE `'.$sTable.'` DROP `wysiwyg_id`';
641
//        echo ($database->query($sql) ? " $OK<br />" : " $FAIL!<br />");
642
    }
643
	echo "Change PRIMARY KEY from table mod_wysiwygs";
644
    $sql = 'ALTER TABLE `'.DB_NAME.'`.`'.$sTable.'` ADD PRIMARY KEY (`section_id`)';
645
    echo ($database->query($sql) ? " $OK<br />" : " $FAIL!<br />");
726
    echo '</div>';
646 727

  
647

  
648 728
}
649 729

  
650 730
/**********************************************************
651
 * upgrade media folder index protect files
652
 ALTER TABLE `wb_pages` CHANGE `page_icon` `page_icon` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
731
 * This part with changing in mod_wysiwyg will be removed in the final version
732
 * special workout for the tester
733
 *  - Remove/add PRIMARY KEY from/to "section_id" from table "mod_wysiwygs"
653 734
 */
654
	$dir = (WB_PATH.MEDIA_DIRECTORY);
655
	echo '<h4>Upgrade '.MEDIA_DIRECTORY.'/ index.php protect files</h4>';
656
	$array = rebuildFolderProtectFile($dir);
657
	if( sizeof( $array ) ){
658
		print '<strong>Upgrade '.sizeof( $array ).' '.MEDIA_DIRECTORY.'/ protect files</strong>'." $OK<br />";
659
	} else {
660
		print '<<strong>Upgrade '.MEDIA_DIRECTORY.'/ protect files</strong>'." $FAIL!<br />";
661
		print implode ('<br />',$array);
662
	}
735
if($bDebugModus) {
736
    echo '<div style="margin-left:2em;">';
663 737

  
664
/**********************************************************
665
 * upgrade pages folder index access files
666
 */
667
	echo '<h4>Upgrade /pages/ index.php access files</h4>';
668

  
669
    ///**********************************************************
670
    // *  - try to remove access files
671
    // */
672
	$sTempDir = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '');
673
	if(($sTempDir!='') && is_readable(WB_PATH.$sTempDir)==true) {
674
	 	if(rm_full_dir (WB_PATH.$sTempDir, true )==false) {
675
			$msg[] = '<strong>Could not delete existing access files</strong>';
676
	 	} else {
677
			$msg[] = createFolderProtectFile(rtrim( WB_PATH.$sTempDir,'/') );
738
    $sTable = TABLE_PREFIX.'mod_wysiwyg';
739
    $field_name = 'wysiwyg_id';
740
    if($database->field_exists($sTable, 'wysiwyg_id')) {
741
        if($database->index_exists($sTable, 'PRIMARY')) {
742
            echo "<span>Remove PRIMARY KEY from table mod_wysiwyg.wysiwyg_id</span>";
743
            echo $database->index_remove($sTable, 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />";
678 744
        }
679
	}
745
        echo "<span>Remove field 'wysiwyg_id' from table mod_wysiwyg</span>";
746
        echo $database->field_remove($sTable, 'wysiwyg_id') ? " $OK<br />" : " $FAIL!<br />";
747
    }
680 748

  
681
    ///**********************************************************
682
    // *  - Reformat/rebuild all existing access files
683
    // */
684
    $msg[] = "Refresh all existing access files ";
685
    $sql = 'SELECT `page_id`,`root_parent`,`link`, `level` FROM `'.TABLE_PREFIX.'pages` ORDER BY `link`';
686
    if (($oPage = $database->query($sql)))
687
    {
688
        $x = 0;
689
        while (($page = $oPage->fetchRow(MYSQL_ASSOC)))
690
        {
691
            // Work out level
692
            $level = level_count($page['page_id']);
693
            // Work out root parent
694
            $root_parent = root_parent($page['page_id']);
695
            // Work out page trail
696
            $page_trail = get_page_trail($page['page_id']);
697
            // Update page with new level and link
698
            $sql  = 'UPDATE `'.TABLE_PREFIX.'pages` SET ';
699
            $sql .= '`root_parent` = '.$root_parent.', ';
700
            $sql .= '`level` = '.$level.', ';
701
            $sql .= '`page_trail` = "'.$page_trail.'" ';
702
            $sql .= 'WHERE `page_id` = '.$page['page_id'];
749
    echo "<br /><span>Create PRIMARY KEY ( `section_id` ) on table mod_wysiwygs.</span>";
750
    echo $database->index_add($sTable, '', 'section_id', 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />";
751
    echo '</div>';
752
}
703 753

  
704
            if(!$database->query($sql)) {}
705
            $filename = WB_PATH.PAGES_DIRECTORY.$page['link'].PAGE_EXTENSION;
706
            $msg = create_access_file($filename, $page['page_id'], $page['level']);
707
            $x++;
708
        }
709
        $msg[] = '<strong>Number of new formatted access files: '.$x.'</strong>';
754
echo '<h3>Step '.(++$stepID).': Updating acess and protected files in folders</h3>';
755

  
756
echo '<div style="margin-left:2em;">';
757
    /**********************************************************
758
    * upgrade media directory index protect files
759
    */
760
    $dir = (WB_PATH.MEDIA_DIRECTORY);
761
    echo '<h4>Upgrade media directory '.MEDIA_DIRECTORY.'/ index.php protect files</h4>';
762
    $array = rebuildFolderProtectFile($dir);
763
    if( sizeof( $array ) ){
764
    	print '<span><strong>Upgrade '.sizeof( $array ).' directory '.MEDIA_DIRECTORY.'/ protect files</strong></span>'." $OK<br />";
765
    } else {
766
    	print '<span><strong>Upgrade directory '.MEDIA_DIRECTORY.'/ protect files</strong></span>'." $FAIL!<br />";
767
    	print implode ('<br />',$array);
710 768
    }
711 769

  
712
	print implode ('<br />',$msg);
770
    /**********************************************************
771
     * upgrade pages directory index access files
772
     */
773
	echo '<h4>Upgrade pages directory '.PAGES_DIRECTORY.'/  protect and access files</h4>';
713 774

  
714
/*
715
	if( sizeof( $msg ) ){
775
    /**********************************************************
776
     *  - Reformat/rebuild all existing access files
777
     */
778
    $sPagePath = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '');
779
    $msg = rebuild_all_accessfiles();
716 780

  
717
		print '<br /><strong>Upgrade '.sizeof( $msg ).' /pages/ access files</strong>'." $OK<br />";
718
	} else {
719
		print '<br /><strong>Upgrade /pages/ access files</strong>'." $FAIL!<br />";
720
		print implode ('<br />',$msg);
721
	}
722
*/
723
/**********************************************************
724
 * upgrade posts folder index protect files
725
 */
726
	$sPostsPath = WB_PATH.PAGES_DIRECTORY.'/posts';
727
	echo '<h4>Upgrade /posts/ index.php protect files</h4>';
728
	$array = rebuildFolderProtectFile($sPostsPath);
729
	if( sizeof( $array ) ){
730
		print '<strong>Upgrade '.sizeof( $array ).' /posts/ protect files</strong>'." $OK<br />";
731
	} else {
732
		print '<strong>Upgrade /posts/ protect files</strong>'." $FAIL!<br />";
733
		print implode ('<br />',$array);
734
	}
781
	print implode ('<br />',$msg);
782
    echo '</div>';
783
    /* *****************************************************************************
784
     * - check for deprecated / never needed files
785
     */
786
    if(sizeof($aFilesToRemove)) {
787
    	echo '<h3>Step '.(++$stepID).': Remove deprecated and old files</h3>';
788
    	$searches = array(
789
    		'[ADMIN]',
790
    		'[MEDIA]',
791
    		'[PAGES]',
792
    		'[FRAMEWORK]',
793
    		'[MODULES]',
794
    		'[TEMPLATE]'
795
    	);
796
    	$replacements = array(
797
    		'/'.substr(ADMIN_PATH, strlen(WB_PATH)+1),
798
    		MEDIA_DIRECTORY,
799
    		PAGES_DIRECTORY,
800
    		'/framework',
801
    		'/modules',
802
    		'/templates'
803
    	);
735 804

  
736
/* *****************************************************************************
737
 * - check for deprecated / never needed files
738
 */
739
	if(sizeof($filesRemove)) {
740
		echo '<h3>Step '.(++$stepID).': Remove deprecated and old files</h3>';
741
	}
742
	$searches = array(
743
		'[ADMIN]',
744
		'[MEDIA]',
745
		'[PAGES]',
746
		'[FRAMEWORK]',
747
		'[MODULES]',
748
		'[TEMPLATE]'
749
	);
750
	$replacements = array(
751
		substr(ADMIN_PATH, strlen(WB_PATH)+1),
752
		MEDIA_DIRECTORY,
753
		PAGES_DIRECTORY,
754
		'/framework',
755
		'/modules',
756
		'/templates'
757
	);
758

  
759
	foreach( $filesRemove as $filesId )
760
	{
761 805
		$msg = '';
762
		foreach( $filesId as $file )
763
		{
806
    	foreach( $aFilesToRemove as $file )
807
    	{
764 808
			$file = str_replace($searches, $replacements, $file);
765
			$file = WB_PATH.'/'.$file;
766
			if( file_exists($file) ) {
809
			if( is_writable(WB_PATH.'/'.$file) ) {
767 810
				// try to unlink file
768
				if(!is_writable( $file ) || !unlink($file)) {
811
				if(!unlink(WB_PATH.$file)) {
769 812
					// save in err-list, if failed
770 813
					$msg .= $file.'<br />';
771
				}
814
				} else {
815
					$msg .= $file.'<br />';
816
    			}
772 817
			}
773
		}
818
    	}
774 819

  
775 820
		if($msg != '')
776 821
		{
......
783 828
			echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
784 829
			echo '&nbsp;<input name="send" type="submit" value="Restart upgrade script" />';
785 830
			echo '</form>';
786
			echo '<br /><br /></div></body></html>';
831
            echo "<br /><br /></div>
832
            </div>
833
            </div>
834
            </body>
835
            </html>
836
            ";
787 837
			exit;
788 838
		}
789
	}
839
    }
790 840

  
791 841

  
792 842
/**********************************************************
......
818 868
				}
819 869
			}
820 870
		}
871

  
821 872
		if($msg != '') {
822 873
			$msg = '<br /><br />Following directories are deprecated, outdated or a security risk and
823 874
					can not be removed automatically.<br /><br />Please delete them
......
827 878
			echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
828 879
			echo '&nbsp;<input name="send" type="submit" value="Restart upgrade script" />';
829 880
			echo '</form>';
830
			echo '<br /><br /></div></body></html>';
881
            echo "<br /><br /></div>
882
            </div>
883
            </div>
884
            </body>
885
            </html>
886
            ";
831 887
			exit;
832 888
		}
833 889
	}
834 890

  
835
/**********************************************************
836
 * upgrade modules if newer version is available
837
 */
838
	$aModuleList = array('news');
891
    /**********************************************************
892
     * upgrade modules if newer version is available
893
     * $aModuleList list of proofed modules
894
     */
895
    $sModuleList = 'news,wysiwyg,form';
896
    $aModuleList = explode(',', (defined('MODULES_UPGRADE_LIST') ? MODULES_UPGRADE_LIST : $sModuleList));
897
    echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
898
//	$aModuleList = array('news');
839 899
	foreach($aModuleList as $sModul) {
840 900
		if(file_exists(WB_PATH.'/modules/'.$sModul.'/upgrade.php')) {
841 901
			$currModulVersion = get_modul_version ($sModul, false);
842 902
			$newModulVersion =  get_modul_version ($sModul, true);
843 903
			if((version_compare($currModulVersion, $newModulVersion) <= 0)) {
844
				echo '<h3>Step '.(++$stepID).' : Upgrade module \''.$sModul.'\' to version '.$newModulVersion.'</h3>';
904
                echo '<div style="margin-left:2em;">';
905
				echo '<h4>'.'Upgrade module \''.$sModul.'\' version '.$newModulVersion.'</h4>';
845 906
				require_once(WB_PATH.'/modules/'.$sModul.'/upgrade.php');
907
                echo '</div>';
846 908
			}
847 909
		}
848 910
	}
911

  
849 912
/**********************************************************
850 913
 *  - Reload all addons
851 914
 */
852 915

  
853
	echo '<h3>Step '.(++$stepID).' : Reload all addons database entry (no upgrade)</h3>';
916
	echo '<h3>Step '.(++$stepID).' : Reload all addons database entry (no upgrade)</h3><br />';
917
    echo '<div style="margin-left:2em;">';
918
    $iFound = 0;
919
    $iLoaded = 0;
854 920
	////delete modules
855 921
	//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
856 922
	// Load all modules
857 923
	if( ($handle = opendir(WB_PATH.'/modules/')) ) {
858 924
		while(false !== ($file = readdir($handle))) {
859 925
			if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
860
				load_module(WB_PATH.'/modules/'.$file );
926
                $iFound++;
927
				$iLoaded = load_module(WB_PATH.'/modules/'.$file ) ? $iLoaded+1 : $iLoaded;
861 928
			   // 	upgrade_module($file, true);
862 929
			}
863 930
		}
864 931
		closedir($handle);
865 932
	}
866
	echo '<strong><br />Modules reloaded<br /></strong>';
933
	echo '<span><strong>'.$iLoaded.' Modules reloaded,</span> found '.$iFound.' directories in folder /modules/</strong><br />';
867 934

  
935
    $iFound = 0;
936
    $iLoaded = 0;
868 937
	////delete templates
869 938
	//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
870 939
	// Load all templates
871 940
	if( ($handle = opendir(WB_PATH.'/templates/')) ) {
872 941
		while(false !== ($file = readdir($handle))) {
873 942
			if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
874
				load_template(WB_PATH.'/templates/'.$file);
943
                $iFound++;
944
				$iLoaded = (load_template(WB_PATH.'/templates/'.$file)==true) ? $iLoaded+1 : $iLoaded;
875 945
			}
876 946
		}
877 947
		closedir($handle);
878 948
	}
879
	echo '<strong><br />Templates reloaded<br /></strong>';
949
	echo '<span><strong>'.$iLoaded.' Templates reloaded,</span> found '.$iFound.' directories in folder /templates/</strong><br />';
880 950

  
951
    $iFound = 0;
952
    $iLoaded = 0;
881 953
	////delete languages
882 954
	//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
883 955
	// Load all languages
884 956
	if( ($handle = opendir(WB_PATH.'/languages/')) ) {
885 957
		while(false !== ($file = readdir($handle))) {
886 958
			if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
887
				load_language(WB_PATH.'/languages/'.$file);
959
                $iFound++;
960
				$iLoaded = load_language(WB_PATH.'/languages/'.$file) ? $iLoaded+1 : $iLoaded;
888 961
			}
889 962
		}
890 963
		closedir($handle);
891 964
	}
892
	echo '<strong><br />Languages reloaded<br /></strong>';
965
	echo '<span><strong>'.$iLoaded.' Languages reloaded,</span> found '.$iFound.' files in folder /languages/</strong><br />';
966
    echo '</div>';
893 967

  
894 968
/**********************************************************
895 969
 *  - install new droplets
......
907 981
/**********************************************************
908 982
 *  - Set Version to new Version
909 983
 */
910
echo '<br />Update database version number to '.VERSION.' '.SP.' '.' Revision ['.REVISION.'] : ';
984
echo '<h3>Step '.(++$stepID).': Update database version number </h3>';
985
echo '<div style="margin-left:2em;">';
911 986

  
912 987
$cfg = array(
913 988
	'wb_version' => VERSION,
914 989
	'wb_revision' => REVISION,
915 990
	'wb_sp' => SP
916 991
);
917

  
992
echo '<br /><span><strong>Set database version number to '.VERSION.' '.SP.' '.' Revision ['.REVISION.'] : </strong></span>';
918 993
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
994
echo '</div>';
919 995

  
920
	echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
921
	status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
922
	// show buttons to go to the backend or frontend
923
	echo '<br />';
996
echo '<p style="font-size:140%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
997
status_msg('<strong>:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
998
// show buttons to go to the backend or frontend
999
echo '<br />';
924 1000

  
925
	if(defined('WB_URL')) {
926
		echo '<form action="'.WB_URL.'/">';
927
		echo '&nbsp;<input type="submit" value="kick me to the Frontend" />';
928
		echo '</form>';
929
	}
930
	if(defined('ADMIN_URL')) {
931
		echo '<form action="'.ADMIN_URL.'/">';
932
		echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
933
		echo '</form>';
934
	}
1001
if(defined('WB_URL')) {
1002
	echo '<form action="'.WB_URL.'/">';
1003
	echo '&nbsp;<input type="submit" value="kick me to the Frontend" />';
1004
	echo '</form>';
1005
}
1006
if(defined('ADMIN_URL')) {
1007
	echo '<form action="'.ADMIN_URL.'/">';
1008
	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
1009
	echo '</form>';
1010
}
935 1011

  
936
	echo '<br /><br /></div></body></html>';
1012
echo "<br /><br /></div>
1013
</div>
1014
</div>
1015
</body>
1016
</html>
1017
";
1018
exit();

Also available in: Unified diff