Project

General

Profile

« Previous | Next » 

Revision 1768

Added by Dietmar about 12 years ago

+ add 2 fields custom01, custom02 with VARCHAR to table pages
! update upgrade-script with this 2 fields

View differences:

upgrade-script.php
425 425
    }
426 426

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

  
429
if($bDebugModus) {
428
$aDebugMessage = array();
430 429
    /**********************************************************
431 430
     *  - Adding field default_theme to settings table
432 431
     */
433
    echo '<div style="margin-left:2em;">';
434
    echo "<br /><span><strong>Adding default_theme to settings table</strong></span>";
432
    $aDebugMessage[] = '<div style="margin-left:2em;">';
433
    $aDebugMessage[] = "<br /><span><strong>Adding default_theme to settings table</strong></span>";
435 434
    // 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>';
435
    $aDebugMessage[] = (db_update_key_value( 'settings', 'default_theme', $DEFAULT_THEME ) ? " $OK<br />" : " $FAIL!<br />");
436
    $aDebugMessage[] = '</div>';
438 437

  
438
if($bDebugModus) {
439
    echo implode(PHP_EOL,$aDebugMessage);
439 440
}
440
    echo '<h3>Step '.(++$stepID).': Updating core tables</h3>';
441

  
442
if($bDebugModus) {
441
$aDebugMessage = array();
442
echo'<h3>Step '.(++$stepID).': Updating core tables</h3>';
443 443
    /**********************************************************
444 444
     *  - Adding field sec_anchor to settings table
445 445
     */
446 446
    echo '<div style="margin-left:2em;">';
447 447
    echo "<h4>Adding/updating entries on table settings</h4>";
448
    echo "<span>Adding/updating sec_anchor to settings table</span>";
448
    $aDebugMessage[] = "<span>Adding/updating sec_anchor to settings table</span>";
449 449
    $cfg = array(
450 450
    	'sec_anchor' => defined('SEC_ANCHOR') ? SEC_ANCHOR : 'section_'
451 451
    );
452 452

  
453
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
453
   $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
454 454

  
455 455

  
456 456
    /**********************************************************
457 457
     *  - Adding redirect timer to settings table
458 458
     */
459
    echo "<span>Adding/updating redirect timer to settings table</span>";
459
    $aDebugMessage[] = "<span>Adding/updating redirect timer to settings table</span>";
460 460
    $cfg = array(
461 461
    	'redirect_timer' => defined('REDIRECT_TIMER') ? REDIRECT_TIMER : '1500'
462 462
    );
463
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
463
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
464 464

  
465 465
    /**********************************************************
466 466
     *  - Adding rename_files_on_upload to settings table
467 467
     */
468
    echo "<span>Adding/Updating rename_files_on_upload to settings table</span>";
468
    $aDebugMessage[] = "<span>Adding/Updating rename_files_on_upload to settings table</span>";
469 469
    $cfg = array(
470 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 471
    );
472
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
472
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
473 473

  
474 474
    /**********************************************************
475 475
     *  - Adding mediasettings to settings table
476 476
     */
477
    echo "<span>Adding/updating mediasettings to settings table</span>";
477
    $aDebugMessage[] = "<span>Adding/updating mediasettings to settings table</span>";
478 478
    $cfg = array(
479 479
    	'mediasettings' => (defined('MEDIASETTINGS') ? MEDIASETTINGS : ''),
480 480
    );
481 481

  
482
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
482
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
483 483

  
484 484
    /**********************************************************
485 485
     *  - Adding fingerprint_with_ip_octets to settings table
486 486
     */
487
    echo "<span>Adding/updating fingerprint_with_ip_octets to settings table</span>";
487
    $aDebugMessage[] = "<span>Adding/updating fingerprint_with_ip_octets to settings table</span>";
488 488
    $cfg = array(
489 489
    	'fingerprint_with_ip_octets' => (defined('FINGERPRINT_WITH_IP_OCTETS') ? FINGERPRINT_WITH_IP_OCTETS : '2'),
490 490
    	'secure_form_module' => (defined('SECURE_FORM_MODULE') ? SECURE_FORM_MODULE : '')
491 491
    );
492 492

  
493
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
493
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
494 494

  
495 495
    /**********************************************************
496 496
     *  - Adding page_icon_dir to settings table
497 497
     */
498
    echo "<span>Adding/updating page_icon_dir to settings table</span>";
498
    $aDebugMessage[] = "<span>Adding/updating page_icon_dir to settings table</span>";
499 499
    $cfg = array(
500 500
    	'page_icon_dir' => (defined('PAGE_ICON_DIR') ? PAGE_ICON_DIR : '/templates/*/title_images'),
501 501
    );
502 502

  
503
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
503
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
504 504
    /**********************************************************
505 505
     *  - Adding page_extended to settings table
506 506
     */
507
    echo "<span>Adding/updating page_extended to settings table</span>";
507
    $aDebugMessage[] = "<span>Adding/updating page_extended to settings table</span>";
508 508
    $cfg = array(
509 509
    	'page_extended' => (defined('PAGE_EXTENDED') ? PAGE_EXTENDED : 'true'),
510 510
    );
511 511

  
512
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
512
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
513 513

  
514 514
    /**********************************************************
515 515
     *  - Adding website_signature to settings table
516 516
     */
517
    echo "<span>Adding/updating website_signature to settings table</span>";
517
    $aDebugMessage[] = "<span>Adding/updating website_signature to settings table</span>";
518 518
    $cfg = array(
519 519
    	'website_signature' => (defined('WEBSITE_SIGNATURE') && (WEBSITE_SIGNATURE=='') ? '' : WEBSITE_SIGNATURE)
520 520
    );
521 521

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

  
524 524
    /**********************************************************
525 525
     *  - Adding confirmed_registration to settings table
526 526
     */
527
    echo "<span>Adding/updating confirmed_registration to settings table</span>";
527
    $aDebugMessage[] = "<span>Adding/updating confirmed_registration to settings table</span>";
528 528
    $cfg = array(
529 529
    	'confirmed_registration' => (defined('CONFIRMED_REGISTRATION') && (CONFIRMED_REGISTRATION=='') ? '' : CONFIRMED_REGISTRATION)
530 530
    );
531 531

  
532
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
532
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
533 533

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

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

  
544 544
    /**********************************************************
545 545
     *  - Adding dev_infos to settings table
546 546
     */
547
    echo "<span>Adding/updating modules_upgrade_list to settings table</span>";
547
    $aDebugMessage[] = "<span>Adding/updating modules_upgrade_list to settings table</span>";
548 548
    $cfg = array(
549 549
    	'modules_upgrade_list' => (defined('MODULES_UPGRADE_LIST') ? MODULES_UPGRADE_LIST : 'news')
550 550
    );
551 551

  
552
    echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
552
    $aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
553 553

  
554
    echo '</div>';
555 554

  
556

  
555
if($bDebugModus) {
556
    echo implode(PHP_EOL,$aDebugMessage);
557 557
}
558
echo '</div>';
558 559

  
560
$aDebugMessage = array();
559 561
if(version_compare(WB_REVISION, REVISION, '<'))
560 562
{
561 563
    echo '<div style="margin-left:2em;">';
......
706 708
	echo "<span>Modify field viewing_users to pages table";
707 709
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
708 710

  
711
	/**********************************************************
712
     *  - Add field "custom01" to table "pages"
713
     */
714
	$table_name = TABLE_PREFIX.'pages';
715
	$field_name = 'custom01';
716
	$description = "VARCHAR( 255 ) NOT NULL DEFAULT '' ";
717
	if(!$database->field_exists($table_name,$field_name)) {
718
		echo "<span>Adding field custom01 to pages table</span>";
719
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
720
	} else {
721
		echo "<span>Modify field custom01 to pages table</span>";
722
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
723
	}
709 724

  
725
	/**********************************************************
726
     *  - Add field "custom02" to table "pages"
727
     */
728
	$table_name = TABLE_PREFIX.'pages';
729
	$field_name = 'custom02';
730
	$description = "VARCHAR( 255 ) NOT NULL DEFAULT '' ";
731
	if(!$database->field_exists($table_name,$field_name)) {
732
		echo "<span>Adding field custom02 to pages table</span>";
733
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
734
	} else {
735
		echo "<span>Modify field custom02 to pages table</span>";
736
		echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
737
	}
738

  
710 739
    /**********************************************************
711 740
     * modify wrong strucre on table sections
712 741
     * wrong structure let crash wb
......
727 756

  
728 757
}
729 758

  
759
if($bDebugModus) {
760
    echo implode(PHP_EOL,$aDebugMessage);
761
}
762
$aDebugMessage = array();
730 763
/**********************************************************
731 764
 * This part with changing in mod_wysiwyg will be removed in the final version
732 765
 * special workout for the tester
733 766
 *  - Remove/add PRIMARY KEY from/to "section_id" from table "mod_wysiwygs"
734 767
 */
735
if($bDebugModus) {
736
    echo '<div style="margin-left:2em;">';
768
    $aDebugMessage[] = '<div style="margin-left:2em;">';
737 769

  
738 770
    $sTable = TABLE_PREFIX.'mod_wysiwyg';
739 771
    $field_name = 'wysiwyg_id';
740 772
    if($database->field_exists($sTable, 'wysiwyg_id')) {
741 773
        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 />";
774
            $aDebugMessage[] = "<span>Remove PRIMARY KEY from table mod_wysiwyg.wysiwyg_id</span>";
775
            $aDebugMessage[] = $database->index_remove($sTable, 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />";
744 776
        }
745
        echo "<span>Remove field 'wysiwyg_id' from table mod_wysiwyg</span>";
746
        echo $database->field_remove($sTable, 'wysiwyg_id') ? " $OK<br />" : " $FAIL!<br />";
777
        $aDebugMessage[] = "<span>Remove field 'wysiwyg_id' from table mod_wysiwyg</span>";
778
        $aDebugMessage[] = $database->field_remove($sTable, 'wysiwyg_id') ? " $OK<br />" : " $FAIL!<br />";
747 779
    }
748 780

  
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>';
781
    $aDebugMessage[] = "<br /><span>Create PRIMARY KEY ( `section_id` ) on table mod_wysiwygs.</span>";
782
    $aDebugMessage[] = $database->index_add($sTable, '', 'section_id', 'PRIMARY') ? " $OK<br />" : " $FAIL!<br />";
783
    $aDebugMessage[] = '</div>';
784

  
785
if($bDebugModus) {
786
// $aDebugMessage[] =
787
    echo implode(PHP_EOL,$aDebugMessage);
752 788
}
789
$aDebugMessage = array();
753 790

  
754 791
echo '<h3>Step '.(++$stepID).': Updating acess and protected files in folders</h3>';
755 792

  

Also available in: Unified diff