Revision 1920
Added by Dietmar over 11 years ago
upgrade-script.php | ||
---|---|---|
41 | 41 |
require($config_file); |
42 | 42 |
|
43 | 43 |
} |
44 |
//require_once(WB_PATH.'/framework/class.admin.php'); |
|
45 |
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); } |
|
46 |
$admin = new admin('Addons', 'modules', false, false); |
|
47 |
|
|
44 | 48 |
// solved wrong pages_directory value before creating access files |
45 | 49 |
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` ' |
46 | 50 |
. 'WHERE `name`=\'pages_directory\''; |
... | ... | |
53 | 57 |
. 'WHERE `name`=\'pages_directory\' '; |
54 | 58 |
WbDatabase::getInstance()->query($sql); |
55 | 59 |
} |
56 |
//require_once(WB_PATH.'/framework/class.admin.php'); |
|
57 |
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); } |
|
58 | 60 |
require_once(WB_PATH.'/framework/functions.php'); |
59 | 61 |
// require_once(WB_PATH.'/framework/Database.php'); |
60 |
$admin = new admin('Addons', 'modules', false, false); |
|
61 | 62 |
|
62 | 63 |
$oldVersion = 'Version '.WB_VERSION; |
63 | 64 |
$oldVersion .= (defined('WB_SP') ? WB_SP : ''); |
... | ... | |
320 | 321 |
<h1>WebsiteBaker Upgrade</h1> |
321 | 322 |
<?php |
322 | 323 |
if( version_compare( WB_VERSION, '2.7', '<' )) { |
323 |
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'); |
|
324 |
echo '<br /><br />'; |
|
324 |
status_msg('<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'); |
|
325 | 325 |
echo "</div> |
326 | 326 |
</div> |
327 | 327 |
</div> |
... | ... | |
330 | 330 |
"; |
331 | 331 |
exit(); |
332 | 332 |
} |
333 |
if($admin->get_user_id()!=1){ |
|
334 |
status_msg('<br /><h3>WebsiteBaker upgrading is not possible!<br />Before upgrading to Revision '.REVISION.' you have to login as System-Administrator!</h3>', 'warning', 'div'); |
|
335 |
echo '<br /><br />'; |
|
336 |
// delete remember key of current user from database |
|
337 |
//if (isset($_SESSION['USER_ID']) && isset($database)) { |
|
338 |
// $table = TABLE_PREFIX . 'users'; |
|
339 |
// $sql = "UPDATE `$table` SET `remember_key` = '' WHERE `user_id` = '" . (int) $_SESSION['USER_ID'] . "'"; |
|
340 |
// $database->query($sql); |
|
341 |
//} |
|
333 | 342 |
|
343 |
// delete remember key cookie if set |
|
344 |
if (isset($_COOKIE['REMEMBER_KEY'])) { |
|
345 |
setcookie('REMEMBER_KEY', '', time() - 3600, '/'); |
|
346 |
} |
|
347 |
|
|
348 |
// delete most critical session variables manually |
|
349 |
$_SESSION['USER_ID'] = null; |
|
350 |
$_SESSION['GROUP_ID'] = null; |
|
351 |
$_SESSION['GROUPS_ID'] = null; |
|
352 |
$_SESSION['USERNAME'] = null; |
|
353 |
$_SESSION['PAGE_PERMISSIONS'] = null; |
|
354 |
$_SESSION['SYSTEM_PERMISSIONS'] = null; |
|
355 |
// overwrite session array |
|
356 |
$_SESSION = array(); |
|
357 |
// delete session cookie if set |
|
358 |
if (isset($_COOKIE[session_name()])) { |
|
359 |
setcookie(session_name(), '', time() - 42000, '/'); |
|
360 |
} |
|
361 |
// delete the session itself |
|
362 |
session_destroy(); |
|
363 |
status_msg('<br /><h3>After login as System-Adminstrator you have to start upgrade-script.php again!</h3>', 'info', 'div'); |
|
364 |
echo '<br /><br />'; |
|
365 |
if(defined('ADMIN_URL')) { |
|
366 |
echo '<form action="'.ADMIN_URL.'/index.php" method="post">'; |
|
367 |
echo ' <input name="backend_send" type="submit" value="Kick me to the Login" />'; |
|
368 |
echo '</form>'; |
|
369 |
} |
|
370 |
echo "<br /><br /></div> |
|
371 |
</div> |
|
372 |
</div> |
|
373 |
</body> |
|
374 |
</html> |
|
375 |
"; |
|
376 |
exit(); |
|
377 |
} |
|
378 |
|
|
334 | 379 |
?> |
335 | 380 |
<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> |
336 | 381 |
|
... | ... | |
409 | 454 |
$aDebugMessage[] = "<br /><span><strong>Adding default_theme to settings table</strong></span>"; |
410 | 455 |
// db_update_key_value('settings', 'default_theme', $DEFAULT_THEME); |
411 | 456 |
$cfg = array( |
412 |
'default_theme' => defined('DEFAULT_THEME')&& (DEFAULT_THEME!='') ? DEFAULT_THEME : $DEFAULT_THEME
|
|
457 |
'default_theme' => $DEFAULT_THEME |
|
413 | 458 |
); |
414 | 459 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
415 | 460 |
$aDebugMessage[] = '</div>'; |
... | ... | |
426 | 471 |
echo "<h4>Adding/updating entries on table settings</h4>"; |
427 | 472 |
$aDebugMessage[] = "<span>Adding/updating sec_anchor to settings table</span>"; |
428 | 473 |
$cfg = array( |
429 |
'sec_anchor' => defined('SEC_ANCHOR')&& (SEC_ANCHOR!='') ? SEC_ANCHOR : 'section_'
|
|
474 |
'sec_anchor' => defined( 'SEC_ANCHOR' )&& (SEC_ANCHOR!='') ? SEC_ANCHOR : 'Sec'
|
|
430 | 475 |
); |
431 | 476 |
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
432 | 477 |
|
... | ... | |
811 | 856 |
*/ |
812 | 857 |
$sPagePath = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : ''); |
813 | 858 |
$msg = rebuild_all_accessfiles(); |
814 |
|
|
859 |
$dir = (WB_PATH.PAGES_DIRECTORY); |
|
860 |
// $aDebugMessage = rebuildFolderProtectFile($dir); |
|
815 | 861 |
echo '<strong>'.implode ('<br />',$msg).'</strong>'; |
816 | 862 |
echo '</div>'; |
817 | 863 |
|
... | ... | |
953 | 999 |
* $aModuleList list of proofed modules |
954 | 1000 |
*/ |
955 | 1001 |
$aModuleList = array( |
956 |
'captcha_control','code','form','jsadmin', |
|
957 |
'menu_link','news','output_filter','wrapper','wysiwyg'); |
|
1002 |
'captcha_control','code','droplets','form','jsadmin',
|
|
1003 |
'menu_link','news','output_filter','wrapper','wysiwyg','MultiLingual');
|
|
958 | 1004 |
if(sizeof($aModuleList)) |
959 | 1005 |
{ |
960 | 1006 |
echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>'; |
Also available in: Unified diff
! /modules/admin.php $sSectionIdPrefix
! /admin/media/upload.php change $database->query($sql) to $database->get_one($sql)
! /upgrade-script.php only systemadministartor can call the script
upgrade all dev-module inclding in package