Revision 1454
Added by DarkViper over 14 years ago
| upgrade-script.php | ||
|---|---|---|
| 24 | 24 |
echo '<'.$element .' class="' .$class .'">' .$message .'</' .$element.'>'; |
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 |
$version = '2.8.2'; |
|
| 28 | 27 |
// database tables including in WB package |
| 29 | 28 |
$table_list = array ( |
| 30 | 29 |
'settings','groups','addons','pages','sections','search','users', |
| ... | ... | |
| 108 | 107 |
print '</pre>'; |
| 109 | 108 |
} |
| 110 | 109 |
|
| 110 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 111 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 112 |
$admin = new admin('Addons', 'modules', false, false);
|
|
| 111 | 113 |
?> |
| 112 | 114 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 113 | 115 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| ... | ... | |
| 177 | 179 |
<body> |
| 178 | 180 |
<div id="container"> |
| 179 | 181 |
<img src="templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" /> |
| 180 |
|
|
| 181 | 182 |
<h1>WebsiteBaker Upgrade</h1> |
| 182 |
<p>This script upgrades an existing WebsiteBaker <strong>Version 2.7 and higher</strong> installation to the <strong>Version <?php echo $version ?></strong>. The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p> |
|
| 183 |
<?php |
|
| 184 |
if( version_compare( WB_VERSION, '2.7.0', '<' )) {
|
|
| 185 |
status_msg('<strong>Warning:</strong><br />It is not possible to upgrade from WebsiteBaker Versions bevor 2.7.0.<br />For upgrading to version '.VERSION.' you must upgrade first to v.2.7.0 at least!!!', 'warning', 'div');
|
|
| 186 |
echo '<br /><br />'; |
|
| 187 |
echo "</div> |
|
| 188 |
</body> |
|
| 189 |
</html> |
|
| 190 |
"; |
|
| 191 |
exit(); |
|
| 192 |
} |
|
| 193 |
?> |
|
| 194 |
<p>This script upgrades an existing WebsiteBaker <strong>Version <?php echo WB_VERSION; ?></strong> installation to the <strong>Version <?php echo VERSION ?></strong>. The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p> |
|
| 183 | 195 |
|
| 184 | 196 |
<?php |
| 185 | 197 |
/** |
| ... | ... | |
| 205 | 217 |
"; |
| 206 | 218 |
exit(); |
| 207 | 219 |
} |
| 208 |
|
|
| 209 | 220 |
echo '<h2>Step 2: Updating database entries</h2>'; |
| 210 |
|
|
| 211 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 212 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 213 |
$admin = new admin('Addons', 'modules', false, false);
|
|
| 214 |
|
|
| 215 | 221 |
$OK = '<span class="ok">OK</span>'; |
| 216 | 222 |
$FAIL = '<span class="error">FAILED</span>'; |
| 217 | 223 |
|
| ... | ... | |
| 493 | 499 |
echo mysql_error().'<br />'; |
| 494 | 500 |
|
| 495 | 501 |
} |
| 496 |
|
|
| 497 |
|
|
| 498 |
if ((version_compare(WB_VERSION, '2.8.1') <= 0) && file_exists(WB_PATH."/modules/news/upgrade.php")) |
|
| 499 |
{
|
|
| 500 |
echo '<h4>Upgrade existings postfiles to new format</h4><br />'; |
|
| 501 |
// change old postfiles to new postfiles |
|
| 502 |
require_once(WB_PATH."/modules/news/upgrade.php"); |
|
| 503 |
} |
|
| 504 |
} |
|
| 505 |
|
|
| 502 |
} |
|
| 506 | 503 |
} |
| 507 |
|
|
| 508 | 504 |
} |
| 509 |
|
|
| 510 | 505 |
/********************************************************** |
| 511 |
* - Set Version to WB 2.8.2
|
|
| 506 |
* upgrade news if newer version is available
|
|
| 512 | 507 |
*/ |
| 513 |
echo "<br />Update database version number to 2.8.2 : "; |
|
| 514 |
echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
|
|
| 508 |
if(file_exists(WB_PATH.'/modules/news/upgrade.php')) |
|
| 509 |
{
|
|
| 510 |
$currNewsVersion = get_modul_version ('news', false);
|
|
| 511 |
$newNewsVersion = get_modul_version ('news', true);
|
|
| 512 |
if((version_compare($currNewsVersion, $newNewsVersion) <= 0)) {
|
|
| 513 |
echo '<h4>Upgrade existings basically news module</h4><br />'; |
|
| 514 |
// change old postfiles to new postfiles |
|
| 515 |
require_once(WB_PATH."/modules/news/upgrade.php"); |
|
| 516 |
} |
|
| 517 |
} |
|
| 518 |
/********************************************************** |
|
| 519 |
* - Set Version to new Version |
|
| 520 |
*/ |
|
| 521 |
echo '<br />Update database version number to '.VERSION.' : '; |
|
| 522 |
echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value`='".VERSION."' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
|
|
| 515 | 523 |
|
| 516 | 524 |
/********************************************************** |
| 517 | 525 |
* - Reload all addons |
| 518 | 526 |
*/ |
| 519 | 527 |
|
| 520 |
//delete modules |
|
| 521 |
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
|
|
| 528 |
////delete modules
|
|
| 529 |
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
|
|
| 522 | 530 |
// Load all modules |
| 523 |
if($handle = opendir(WB_PATH.'/modules/')) {
|
|
| 531 |
if( ($handle = opendir(WB_PATH.'/modules/')) ) {
|
|
| 524 | 532 |
while(false !== ($file = readdir($handle))) {
|
| 525 | 533 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
|
| 526 | 534 |
load_module(WB_PATH.'/modules/'.$file); |
| ... | ... | |
| 530 | 538 |
} |
| 531 | 539 |
echo '<br />Modules reloaded<br />'; |
| 532 | 540 |
|
| 533 |
//delete templates
|
|
| 534 |
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
|
|
| 541 |
////delete templates
|
|
| 542 |
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
|
|
| 535 | 543 |
// Load all templates |
| 536 |
if($handle = opendir(WB_PATH.'/templates/')) {
|
|
| 544 |
if( ($handle = opendir(WB_PATH.'/templates/')) ) {
|
|
| 537 | 545 |
while(false !== ($file = readdir($handle))) {
|
| 538 | 546 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
| 539 | 547 |
load_template(WB_PATH.'/templates/'.$file); |
| ... | ... | |
| 543 | 551 |
} |
| 544 | 552 |
echo '<br />Templates reloaded<br />'; |
| 545 | 553 |
|
| 546 |
//delete languages |
|
| 547 |
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
|
|
| 554 |
////delete languages
|
|
| 555 |
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
|
|
| 548 | 556 |
// Load all languages |
| 549 |
if($handle = opendir(WB_PATH.'/languages/')) {
|
|
| 557 |
if( ($handle = opendir(WB_PATH.'/languages/')) ) {
|
|
| 550 | 558 |
while(false !== ($file = readdir($handle))) {
|
| 551 | 559 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
| 552 | 560 |
load_language(WB_PATH.'/languages/'.$file); |
Also available in: Unified diff
in /framework/functions.php::media_filename - replace whitespaces by _
/upgrade-script.php - some small fixes