Project

General

Profile

« Previous | Next » 

Revision 1760

Added by Luisehahne over 12 years ago

! fallback changes in wysiwyg Revision 1754
because it's required that section_id is the PRIMARY KEY
Fallback will be done in upgrade-script until the final version
! build in extra input seo title in page settings
! beginning rebranding wb_theme

View differences:

upgrade-script.php
489 489
		$sql .= 'WHERE `name`=\'no_results\'';
490 490
	    echo ($database->query($sql)) ? ' $OK<br />' : ' $FAIL<br />';
491 491
	}
492

  
492 493
	/**********************************************************
493
 *  - Add field "redirect_type" to table "mod_menu_link"
494
 *  has to be moved later to upgrade.php in modul menu_link, because modul can be removed
495
 */
494
     *  - Add field "redirect_type" to table "mod_menu_link"
495
     *  has to be moved later to upgrade.php in modul menu_link, because modul can be removed
496
     */
496 497
	$table_name = TABLE_PREFIX.'mod_menu_link';
497 498
	$field_name = 'redirect_type';
498 499
	$description = "INT NOT NULL DEFAULT '301' AFTER `target_page_id`";
......
514 515
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
515 516

  
516 517
	/**********************************************************
517
 *  - Add field "page_icon" to table "pages"
518
 */
518
     *  - Add field "page_icon" to table "pages"
519
     */
519 520
	$table_name = TABLE_PREFIX.'pages';
520 521
	$field_name = 'page_icon';
521 522
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_title`";
......
528 529
	}
529 530

  
530 531
	/**********************************************************
531
	 *  - Add field "tooltip" to table "pages"
532
 */
533
	$table_name = TABLE_PREFIX.'pages';
534
	$field_name = 'tooltip';
535
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_icon`";
536
	if(!$database->field_exists($table_name,$field_name)) {
537
		echo "Adding field tooltip to pages table";
538
		echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
539
	} else {
540
	echo "Modify field tooltip to pages table";
541
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
542
	}
543

  
544
	/**********************************************************
545 532
	 *  - Add field "page_code" to table "pages"
546 533
	 */
547 534
	$table_name = TABLE_PREFIX.'pages';
......
556 543
	}
557 544

  
558 545
	/**********************************************************
559
 *  - Add field "menu_icon_0" to table "pages"
560
 */
546
     *  - Add field "menu_icon_0" to table "pages"
547
     */
561 548
	$table_name = TABLE_PREFIX.'pages';
562 549
	$field_name = 'menu_icon_0';
563 550
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_title`";
......
571 558

  
572 559
	/**********************************************************
573 560
	 *  - Add field "menu_icon_1" to table "pages"
574
 */
561
     */
575 562
	$table_name = TABLE_PREFIX.'pages';
576 563
	$field_name = 'menu_icon_1';
577 564
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_0`";
......
585 572

  
586 573
	/**********************************************************
587 574
	 *  - Add field "tooltip" to table "pages"
588
 */
575
     */
589 576
	$table_name = TABLE_PREFIX.'pages';
590 577
	$field_name = 'tooltip';
591 578
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_1`";
......
599 586

  
600 587
	/**********************************************************
601 588
	 *  - Add field "admin_groups" to table "pages"
602
 */
589
     */
603 590
	$table_name = TABLE_PREFIX.'pages';
604 591
	$field_name = 'admin_groups';
605 592
	$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
......
633 620
	echo "Modify field viewing_users to pages table";
634 621
	echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
635 622

  
623

  
624
/**
625
 * This part with changing in mod_wysiwyg will be removed in the final version
626
 * special workout for the tester
627
 */
636 628
	/**********************************************************
637 629
	 *  - Remove/add PRIMARY KEY from/to "section_id" from table "mod_wysiwygs"
638 630
	 */
639 631
	$sTable = TABLE_PREFIX.'mod_wysiwyg';
640 632
	$field_name = 'wysiwyg_id';
641
	if(!$database->field_exists($sTable,$field_name)) {
633
	if($database->field_exists($sTable,$field_name)) {
642 634
    	echo "Remove PRIMARY KEY from table mod_wysiwygs";
643
        $sql = 'ALTER TABLE `'.DB_NAME.'`.`'.$sTable.'` DROP PRIMARY KEY';
635
//ALTER TABLE `wb283_mod_wysiwyg` DROP `wysiwyg_id`
636
        $sql = 'ALTER TABLE `'.DB_NAME.'`.`'.$sTable.'` DROP `wysiwyg_id`';
644 637
        echo ($database->query($sql) ? " $OK<br />" : " $FAIL!<br />");
645 638

  
646
    	echo "add new PRIMARY KEY to table mod_wysiwygs";
647
        $sql = 'ALTER TABLE `'.$sTable.'`  ADD `wysiwyg_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST';
648
        echo ($database->query($sql) ? " $OK<br />" : " $FAIL!<br />");
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 />");
649 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 />");
646

  
647

  
650 648
}
651 649

  
652 650
/**********************************************************
......
683 681
    ///**********************************************************
684 682
    // *  - Reformat/rebuild all existing access files
685 683
    // */
686
    $msg[] = "All existing access files anew format";
684
    $msg[] = "Refresh all existing access files ";
687 685
    $sql = 'SELECT `page_id`,`root_parent`,`link`, `level` FROM `'.TABLE_PREFIX.'pages` ORDER BY `link`';
688 686
    if (($oPage = $database->query($sql)))
689 687
    {
690 688
        $x = 0;
691 689
        while (($page = $oPage->fetchRow(MYSQL_ASSOC)))
692 690
        {
693
            $sql = 'UPDATE `'.TABLE_PREFIX.'pages` '
694
                 . 'SET `root_parent`='.$page['page_id'].' WHERE page_id = '.$page['page_id'];
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'];
703

  
695 704
            if(!$database->query($sql)) {}
696 705
            $filename = WB_PATH.PAGES_DIRECTORY.$page['link'].PAGE_EXTENSION;
697 706
            $msg = create_access_file($filename, $page['page_id'], $page['level']);

Also available in: Unified diff