| | 465 | // Dropping obsolete "handler" field from pages table, refs #452 |
| | 466 | test('Removing handler field from the pages table...', |
| | 467 | @mysql_query("ALTER TABLE ".$config["table_prefix"]."pages DROP handler", $dblink), __('Already done? Hmm!'), 0); |
| | 468 | // Support for threaded comments |
| | 469 | test("Adding fields to comments table to enable threading...", |
| | 470 | mysql_query("alter table ".$config["table_prefix"]."comments add parent int(10) unsigned default NULL", $dblink), "Already done? OK!", 0); |
| | 471 | test("Adding fields to comments table to enable threading...", |
| | 472 | mysql_query("alter table ".$config["table_prefix"]."users add default_comment_display enum('date_asc', 'date_desc', 'threaded') NOT NULL default 'threaded'", $dblink), "Already done? OK!", 0); |
| | 473 | test("Adding fields to comments table to enable threading...", |
| | 474 | mysql_query("alter table ".$config["table_prefix"]."comments add status enum('deleted') default NULL", $dblink), "Already done? OK!", 0); |
| | 475 | // Create new fields for comment_read_acl and comment_post_acl, |
| | 476 | // and copy existing comment_acl values to these new fields |
| | 477 | test('Creating new comment_read_acl field...', |
| | 478 | @mysql_query("alter table ".$config['table_prefix']."acls add comment_read_acl text not null", $dblink), __('Already done? OK!'), 0); |
| | 479 | test('Creating new comment_post_acl field...', |
| | 480 | @mysql_query("alter table ".$config['table_prefix']."acls add comment_post_acl text not null", $dblink), __('Already done? OK!'), 0); |
| | 481 | test('Copying existing comment_acls to new fields...', |
| | 482 | @mysql_query("update ".$config['table_prefix']."acls as a inner join(select page_tag, comment_acl from ".$config['table_prefix']."acls) as b on a.page_tag = b.page_tag set a.comment_read_acl=b.comment_acl, a.comment_post_acl=b.comment_acl", $dblink), __('Failed').'. ?', 1); |
| | 483 | test('Drop old comment acl...', |
| | 484 | @mysql_query("alter table ".$config['table_prefix']."acls drop comment_acl", $dblink), __('Failed').'. ?', 1); |
| | 485 | test(__('Creating index on owner column').'...', |
| | 486 | @mysql_query('alter table '.$config['table_prefix'].'pages add index `idx_owner` (`owner`)', $dblink), __('Already done? OK!'), 0); |
| | 487 | test(__('Altering referrers table structure').'...', |
| | 488 | @mysql_query("ALTER TABLE ".$config['table_prefix']."referrers MODIFY referrer varchar(255) NOT NULL default ''", $dblink), "Failed. ?", 1); |
| | 489 | test(__('Altering referrer blacklist table structure').'...', |
| | 490 | @mysql_query("ALTER TABLE ".$config['table_prefix']."referrer_blacklist MODIFY spammer varchar(255) NOT NULL default ''", $dblink), "Failed. ?", 1); |
| | 491 | update_default_page(array( |
| | 492 | 'FormattingRules', |
| | 493 | 'SysInfo', |
| | 494 | 'WikkaReleaseNotes', |
| | 495 | 'TableMarkup', |
| | 496 | 'TableMarkupReference', |
| | 497 | 'WikkaConfig'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path, $upgrade_note); |
| | 498 | // Backup config/ files |
| | 499 | if(file_exists("config/main_menu.admin.inc")) |
| | 500 | brute_copy("config/main_menu.admin.inc", |
| | 501 | "config/main_menu.admin.inc.prev"); |
| | 502 | if(file_exists("config/main_menu.inc")) |
| | 503 | brute_copy("config/main_menu.inc", |
| | 504 | "config/main_menu.inc.prev"); |
| | 505 | if(file_exists("config/main_menu.user.inc")) |
| | 506 | brute_copy("config/main_menu.user.inc", |
| | 507 | "config/main_menu.user.inc.prev"); |
| | 508 | if(file_exists("config/options_menu.admin.inc")) |
| | 509 | brute_copy("config/options_menu.admin.inc", |
| | 510 | "config/options_menu.admin.inc.prev"); |
| | 511 | if(file_exists("config/options_menu.inc")) |
| | 512 | brute_copy("config/options_menu.inc", |
| | 513 | "config/options_menu.inc.prev"); |
| | 514 | if(file_exists("config/options_menu.user.inc")) |
| | 515 | brute_copy("config/options_menu.user.inc", |
| | 516 | "config/options_menu.user.inc.prev"); |
| | 517 | test(__('Adding challenge field').'...', |
| | 518 | @mysql_query("ALTER TABLE ".$config['table_prefix']."users ADD challenge VARCHAR( 8 ) NOT NULL default ''", $dblink), __('Already done? OK!'), 0); |
| | 519 | case "trunk": |
| | 520 | update_default_page(array( |
| | 521 | 'AdminBadWords', |
| | 522 | 'AdminSpamLog', |
| | 523 | 'WikkaMenulets'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path); |
| | 524 | test("Setting default ACL...", 1); |
| | 525 | mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'WikkaMenulets', read_acl = '!*', write_acl = '!*', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink); |
| | 526 | mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminBadWords', read_acl = '!*', write_acl = '!*', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink); |
| | 527 | mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminSpamLog', read_acl = '!*', write_acl = '!*', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink); |
| 524 | | |
| 525 | | // Dropping obsolete "handler" field from pages table, refs #452 |
| 526 | | test('Removing handler field from the pages table...', |
| 527 | | @mysql_query("ALTER TABLE ".$config["table_prefix"]."pages DROP handler", $dblink), __('Already done? Hmm!'), 0); |
| 528 | | // Support for threaded comments |
| 529 | | test("Adding fields to comments table to enable threading...", |
| 530 | | mysql_query("alter table ".$config["table_prefix"]."comments add parent int(10) unsigned default NULL", $dblink), "Already done? OK!", 0); |
| 531 | | test("Adding fields to comments table to enable threading...", |
| 532 | | mysql_query("alter table ".$config["table_prefix"]."users add default_comment_display enum('date_asc', 'date_desc', 'threaded') NOT NULL default 'threaded'", $dblink), "Already done? OK!", 0); |
| 533 | | test("Adding fields to comments table to enable threading...", |
| 534 | | mysql_query("alter table ".$config["table_prefix"]."comments add status enum('deleted') default NULL", $dblink), "Already done? OK!", 0); |
| 539 | | // Create new fields for comment_read_acl and comment_post_acl, |
| 540 | | // and copy existing comment_acl values to these new fields |
| 541 | | test('Creating new comment_read_acl field...', |
| 542 | | @mysql_query("alter table ".$config['table_prefix']."acls add comment_read_acl text not null", $dblink), __('Already done? OK!'), 0); |
| 543 | | test('Creating new comment_post_acl field...', |
| 544 | | @mysql_query("alter table ".$config['table_prefix']."acls add comment_post_acl text not null", $dblink), __('Already done? OK!'), 0); |
| 545 | | test('Copying existing comment_acls to new fields...', |
| 546 | | @mysql_query("update ".$config['table_prefix']."acls as a inner join(select page_tag, comment_acl from ".$config['table_prefix']."acls) as b on a.page_tag = b.page_tag set a.comment_read_acl=b.comment_acl, a.comment_post_acl=b.comment_acl", $dblink), __('Failed').'. ?', 1); |
| 547 | | test('Drop old comment acl...', |
| 548 | | @mysql_query("alter table ".$config['table_prefix']."acls drop comment_acl", $dblink), __('Failed').'. ?', 1); |
| 549 | | test(__('Creating index on owner column').'...', |
| 550 | | @mysql_query('alter table '.$config['table_prefix'].'pages add index `idx_owner` (`owner`)', $dblink), __('Already done? OK!'), 0); |
| 551 | | test(__('Altering referrers table structure').'...', |
| 552 | | @mysql_query("ALTER TABLE ".$config['table_prefix']."referrers MODIFY referrer varchar(255) NOT NULL default ''", $dblink), "Failed. ?", 1); |
| 553 | | test(__('Altering referrer blacklist table structure').'...', |
| 554 | | @mysql_query("ALTER TABLE ".$config['table_prefix']."referrer_blacklist MODIFY spammer varchar(255) NOT NULL default ''", $dblink), "Failed. ?", 1); |
| 555 | | update_default_page(array( |
| 556 | | 'FormattingRules', |
| 557 | | 'SysInfo', |
| 558 | | 'WikkaReleaseNotes', |
| 559 | | 'TableMarkup', |
| 560 | | 'TableMarkupReference', |
| 561 | | 'WikkaConfig'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path, $upgrade_note); |
| 562 | | // Backup config/ files |
| 563 | | if(file_exists("config/main_menu.admin.inc")) |
| 564 | | brute_copy("config/main_menu.admin.inc", |
| 565 | | "config/main_menu.admin.inc.prev"); |
| 566 | | if(file_exists("config/main_menu.inc")) |
| 567 | | brute_copy("config/main_menu.inc", |
| 568 | | "config/main_menu.inc.prev"); |
| 569 | | if(file_exists("config/main_menu.user.inc")) |
| 570 | | brute_copy("config/main_menu.user.inc", |
| 571 | | "config/main_menu.user.inc.prev"); |
| 572 | | if(file_exists("config/options_menu.admin.inc")) |
| 573 | | brute_copy("config/options_menu.admin.inc", |
| 574 | | "config/options_menu.admin.inc.prev"); |
| 575 | | if(file_exists("config/options_menu.inc")) |
| 576 | | brute_copy("config/options_menu.inc", |
| 577 | | "config/options_menu.inc.prev"); |
| 578 | | if(file_exists("config/options_menu.user.inc")) |
| 579 | | brute_copy("config/options_menu.user.inc", |
| 580 | | "config/options_menu.user.inc.prev"); |
| 581 | | test(__('Adding challenge field').'...', |
| 582 | | @mysql_query("ALTER TABLE ".$config['table_prefix']."users ADD challenge VARCHAR( 8 ) NOT NULL default ''", $dblink), __('Already done? OK!'), 0); |
| 583 | | case "1.4": |
| 584 | | update_default_page(array( |
| 585 | | 'AdminBadWords', |
| 586 | | 'AdminSpamLog', |
| 587 | | 'WikkaMenulets'), $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path); |
| 588 | | test("Setting default ACL...", 1); |
| 589 | | mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'WikkaMenulets', read_acl = '!*', write_acl = '!*', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink); |
| 590 | | mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminBadWords', read_acl = '!*', write_acl = '!*', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink); |
| 591 | | mysql_query("insert into ".$config['table_prefix']."acls set page_tag = 'AdminSpamLog', read_acl = '!*', write_acl = '!*', comment_read_acl = '!*', comment_post_acl = '!*'", $dblink); |