Revision 1688
Added by Luisehahne over 13 years ago
| upgrade-script.php | ||
|---|---|---|
| 4 | 4 |
* @category backend |
| 5 | 5 |
* @package installation |
| 6 | 6 |
* @author WebsiteBaker Project |
| 7 |
* @copyright 2009-2012, Website Baker Org. e.V.
|
|
| 7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V. |
|
| 8 | 8 |
* @link http://www.websitebaker2.org/ |
| 9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 10 | 10 |
* @platform WebsiteBaker 2.8.x |
| ... | ... | |
| 23 | 23 |
$admin = new admin('Addons', 'modules', false, false);
|
| 24 | 24 |
|
| 25 | 25 |
$oldVersion = 'Version '.WB_VERSION; |
| 26 |
$oldVersion .= (defined('WB_SP') ? ' '.WB_SP : '');
|
|
| 27 |
$oldVersion .= (defined('WB_REVISION') ? ' Revision ['.WB_REVISION.'] ' : '') ;
|
|
| 26 |
$oldVersion .= (defined('WB_SP') ? '.'.WB_SP : '');
|
|
| 27 |
$oldRevision = (defined('WB_REVISION') ? ' Revision ['.WB_REVISION.'] ' : '') ;
|
|
| 28 | 28 |
$newVersion = 'Version '.VERSION; |
| 29 |
$newVersion .= (defined('SP') ? ' '.SP : '');
|
|
| 30 |
$newVersion .= (defined('REVISION') ? ' Revision ['.REVISION.'] ' : '');
|
|
| 29 |
$newVersion .= (defined('SP') ? '.'.SP : '');
|
|
| 30 |
$newRevision = (defined('REVISION') ? ' Revision ['.REVISION.'] ' : '');
|
|
| 31 | 31 |
|
| 32 | 32 |
// set addition settings if not exists, otherwise upgrade will be breaks |
| 33 | 33 |
if(!defined('WB_SP')) { define('WB_SP',''); }
|
| ... | ... | |
| 306 | 306 |
} |
| 307 | 307 |
|
| 308 | 308 |
?> |
| 309 |
<p>This script upgrades an existing WebsiteBaker <strong> <?php echo $oldVersion; ?></strong> installation to the <strong> <?php echo $newVersion ?> </strong>.<br />The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p>
|
|
| 309 |
<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>
|
|
| 310 | 310 |
|
| 311 | 311 |
<?php |
| 312 | 312 |
/** |
| ... | ... | |
| 352 | 352 |
|
| 353 | 353 |
if(sizeof($all_tables) == 22) |
| 354 | 354 |
{
|
| 355 |
echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($table_list).' included in package '.$OK.'</h4>';
|
|
| 355 |
echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($aTable).' included in package '.$OK.'</h4>';
|
|
| 356 | 356 |
} |
| 357 | 357 |
else |
| 358 | 358 |
{
|
| ... | ... | |
| 453 | 453 |
|
| 454 | 454 |
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />"); |
| 455 | 455 |
|
| 456 |
if(version_compare(WB_REVISION, '1680', '<'))
|
|
| 456 |
if(version_compare(WB_REVISION, REVISION, '<='))
|
|
| 457 | 457 |
{
|
| 458 | 458 |
echo '<h3>Step '.(++$stepID).': Updating core tables</h3>'; |
| 459 | 459 |
|
| ... | ... | |
| 508 | 508 |
} |
| 509 | 509 |
|
| 510 | 510 |
/********************************************************** |
| 511 |
* - Add field "admin_groups" to table "pages"
|
|
| 511 |
* - Add field "tooltip" to table "pages"
|
|
| 512 | 512 |
*/ |
| 513 | 513 |
$table_name = TABLE_PREFIX.'pages'; |
| 514 | 514 |
$field_name = 'tooltip'; |
| 515 | 515 |
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_icon`"; |
| 516 |
if(!$database->field_exists($table_name,$field_name)) {
|
|
| 517 |
echo "Adding field tooltip to pages table"; |
|
| 518 |
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />"); |
|
| 519 |
} else {
|
|
| 516 | 520 |
echo "Modify field tooltip to pages table"; |
| 517 | 521 |
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />"); |
| 522 |
} |
|
| 518 | 523 |
|
| 519 | 524 |
/********************************************************** |
| 520 | 525 |
* - Add field "page_code" to table "pages" |
| ... | ... | |
| 627 | 632 |
* upgrade pages folder index access files |
| 628 | 633 |
*/ |
| 629 | 634 |
echo '<h4>Upgrade /pages/ index.php access files</h4><br />'; |
| 635 |
|
|
| 630 | 636 |
///********************************************************** |
| 637 |
// * - try to remove access files |
|
| 638 |
// */ |
|
| 639 |
$sTempDir = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '');
|
|
| 640 |
if(($sTempDir!='') && is_readable(WB_PATH.$sTempDir)==true) {
|
|
| 641 |
if(rm_full_dir (WB_PATH.$sTempDir, true )==false) {
|
|
| 642 |
$msg[] = '<strong>Could not delete existing access files</strong><br />'; |
|
| 643 |
} else {
|
|
| 644 |
$msg[] = createFolderProtectFile(rtrim( WB_PATH.$sTempDir,'/') ); |
|
| 645 |
} |
|
| 646 |
} |
|
| 647 |
|
|
| 648 |
///********************************************************** |
|
| 631 | 649 |
// * - Reformat/rebuild all existing access files |
| 632 | 650 |
// */ |
| 633 | 651 |
$msg[] = "All existing access files anew format"; |
Also available in: Unified diff
! update upgrade-script first remove access files in an existing pages folder
before rebuilding them
! for security upgrade don't remove access files in root