Revision 714
Added by Matthias almost 17 years ago
upgrade-script.php | ||
---|---|---|
210 | 210 |
} |
211 | 211 |
} |
212 | 212 |
|
213 |
|
|
213 | 214 |
/********************************************************** |
214 | 215 |
* - publish-by-date |
215 | 216 |
*/ |
... | ... | |
383 | 384 |
// |
384 | 385 |
// Should we really do this? - must be checked |
385 | 386 |
|
387 |
|
|
386 | 388 |
/********************************************************** |
387 | 389 |
* - asp - Advanced Spam Protection |
388 | 390 |
*/ |
... | ... | |
406 | 408 |
('1', '1', 'calc_text') |
407 | 409 |
"); |
408 | 410 |
|
411 |
|
|
409 | 412 |
/********************************************************** |
410 | 413 |
* - multi-group |
411 | 414 |
*/ |
... | ... | |
423 | 426 |
} |
424 | 427 |
|
425 | 428 |
|
429 |
/********************************************************** |
|
430 |
* -Javascript Admin |
|
431 |
*/ |
|
432 |
echo "<br /><u>Adding table mod_jsadmin</u><br />"; |
|
433 |
$table = TABLE_PREFIX ."mod_jsadmin"; |
|
434 |
$database->query("DROP TABLE IF EXISTS `$table`"); |
|
426 | 435 |
|
427 |
//****************************************************************************** |
|
428 |
//Start of upgrade script for the form modul |
|
429 |
//****************************************************************************** |
|
436 |
$database->query(" |
|
437 |
CREATE TABLE `$table` ( |
|
438 |
`id` INT(11) NOT NULL DEFAULT '0', |
|
439 |
`name` VARCHAR(255) NOT NULL DEFAULT '0', |
|
440 |
`value` INT(11) NOT NULL DEFAULT '0', |
|
441 |
PRIMARY KEY (`id`) |
|
442 |
) |
|
443 |
"); |
|
430 | 444 |
|
445 |
global $database; |
|
446 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('1','mod_jsadmin_persist_order','0')"); |
|
447 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('2','mod_jsadmin_ajax_order_pages','0')"); |
|
448 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('3','mod_jsadmin_ajax_order_sections','0')"); |
|
449 |
|
|
450 |
|
|
451 |
/********************************************************** |
|
452 |
* - Output Filter |
|
453 |
*/ |
|
454 |
echo "<br /><u>Adding table mod_outputfilter</u><br />"; |
|
455 |
$table = TABLE_PREFIX .'mod_output_filter'; |
|
456 |
$database->query("DROP TABLE IF EXISTS `$table`"); |
|
457 |
|
|
458 |
$database->query("CREATE TABLE `$table` ( |
|
459 |
`email_filter` VARCHAR(1) NOT NULL DEFAULT '0', |
|
460 |
`mailto_filter` VARCHAR(1) NOT NULL DEFAULT '0', |
|
461 |
`at_replacement` VARCHAR(255) NOT NULL DEFAULT '(at)', |
|
462 |
`dot_replacement` VARCHAR(255) NOT NULL DEFAULT '(dot)' |
|
463 |
)" |
|
464 |
); |
|
465 |
|
|
466 |
// add default values to the module table |
|
467 |
$database->query("INSERT INTO ".TABLE_PREFIX |
|
468 |
."mod_output_filter (email_filter, mailto_filter, at_replacement, dot_replacement) VALUES ('0', '0', '(at)', '(dot)')"); |
|
469 |
|
|
470 |
|
|
471 |
/********************************************************** |
|
472 |
* - Form Modul |
|
473 |
*/ |
|
431 | 474 |
db_add_field('success_email_subject', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`"); |
432 | 475 |
db_add_field('success_email_text', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`"); |
433 | 476 |
db_add_field('success_email_from', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`"); |
... | ... | |
443 | 486 |
} |
444 | 487 |
echo mysql_error().'<br />'; |
445 | 488 |
|
446 |
|
|
447 |
// UPDATING DATA INTO FIELDS |
|
448 |
echo "<BR>"; |
|
449 |
|
|
450 | 489 |
// These are the default setting |
451 | 490 |
$success_page = 'none'; |
452 | 491 |
$success_email_to = ''; |
... | ... | |
497 | 536 |
echo mysql_error().'<br />'; |
498 | 537 |
} |
499 | 538 |
|
500 |
//****************************************************************************** |
|
501 |
//End of upgrade script for the form modul |
|
502 |
//****************************************************************************** |
|
503 | 539 |
|
504 |
//****************************************************************************** |
|
505 |
//Start of upgrade script for the news modul |
|
506 |
//****************************************************************************** |
|
507 |
|
|
540 |
/********************************************************** |
|
541 |
* - News Modul |
|
542 |
*/ |
|
508 | 543 |
db_add_field('published_when', 'mod_news_posts', "INT NOT NULL AFTER `commenting`"); |
509 | 544 |
db_add_field('published_until', 'mod_news_posts', "INT NOT NULL AFTER `published_when`"); |
510 | 545 |
|
511 |
// UPDATING DATA INTO FIELDS |
|
512 |
echo "<BR>"; |
|
513 |
|
|
514 | 546 |
// These are the default setting |
515 | 547 |
$header = '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"98%\">'; |
516 | 548 |
$post_loop = '<tr class=\"post_top\"> |
... | ... | |
590 | 622 |
echo mysql_error().'<br />'; |
591 | 623 |
} |
592 | 624 |
|
593 |
//****************************************************************************** |
|
594 |
//End of upgrade script for the news modul |
|
595 |
//****************************************************************************** |
|
596 | 625 |
|
626 |
/********************************************************** |
|
627 |
* - Add Admintools to Administrator group |
|
628 |
*/ |
|
629 |
echo "<br /><u>Add Admintools to Adminsitrator group</u><br />"; |
|
630 |
$full_system_permissions = 'pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete,admintools'; |
|
631 |
$database->query("UPDATE `".TABLE_PREFIX."groups` SET `system_permissions` = '$full_system_permissions' WHERE `name` = 'Administrators'"); |
|
597 | 632 |
|
598 | 633 |
|
634 |
/********************************************************** |
|
635 |
* - Add Mailer Settings to settings table |
|
636 |
*/ |
|
637 |
echo "<br /><u>Add Mailer Settings to settings table</u><br />"; |
|
638 |
//delete rows to prevent double entries |
|
639 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_routine'"); |
|
640 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'server_email'"); |
|
641 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_default_sendername'"); |
|
642 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_host'"); |
|
643 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_auth'"); |
|
644 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_username'"); |
|
645 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_password'"); |
|
646 |
//add new rows with default values |
|
647 |
$settings_rows= "INSERT INTO `".TABLE_PREFIX."settings` " |
|
648 |
." (name, value) VALUES " |
|
649 |
." ('wbmailer_routine', 'phpmail')," |
|
650 |
." ('server_email', 'admin@yourdomain.com')," // avoid that mail provider (e.g. mail.com) reject mails like yourname@mail.com |
|
651 |
." ('wbmailer_default_sendername', 'WB Mailer')," |
|
652 |
." ('wbmailer_smtp_host', '')," |
|
653 |
." ('wbmailer_smtp_auth', '')," |
|
654 |
." ('wbmailer_smtp_username', '')," |
|
655 |
." ('wbmailer_smtp_password', '')"; |
|
656 |
$database->query($settings_rows); |
|
599 | 657 |
|
658 |
|
|
659 |
/********************************************************** |
|
660 |
* - Reload all addons |
|
661 |
*/ |
|
662 |
|
|
663 |
//delete modules |
|
664 |
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'"); |
|
665 |
// Load all modules |
|
666 |
if($handle = opendir(WB_PATH.'/modules/')) { |
|
667 |
while(false !== ($file = readdir($handle))) { |
|
668 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') { |
|
669 |
load_module(WB_PATH.'/modules/'.$file); |
|
670 |
} |
|
671 |
} |
|
672 |
closedir($handle); |
|
673 |
} |
|
674 |
echo '<br />Modules reloaded<br />'; |
|
675 |
|
|
676 |
//delete templates |
|
677 |
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'"); |
|
678 |
// Load all templates |
|
679 |
if($handle = opendir(WB_PATH.'/templates/')) { |
|
680 |
while(false !== ($file = readdir($handle))) { |
|
681 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') { |
|
682 |
load_template(WB_PATH.'/templates/'.$file); |
|
683 |
} |
|
684 |
} |
|
685 |
closedir($handle); |
|
686 |
} |
|
687 |
echo '<br />Templates reloaded<br />'; |
|
688 |
|
|
689 |
//delete languages |
|
690 |
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'"); |
|
691 |
// Load all languages |
|
692 |
if($handle = opendir(WB_PATH.'/languages/')) { |
|
693 |
while(false !== ($file = readdir($handle))) { |
|
694 |
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') { |
|
695 |
load_language(WB_PATH.'/languages/'.$file); |
|
696 |
} |
|
697 |
} |
|
698 |
closedir($handle); |
|
699 |
} |
|
700 |
echo '<br />Languages reloaded<br />'; |
|
701 |
|
|
702 |
/********************************************************** |
|
703 |
* - Set Version to WB 2.7 |
|
704 |
*/ |
|
705 |
echo "<br /><u>Set Version number to 2.7</u><br />"; |
|
706 |
$version = '2.7'; |
|
707 |
$database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'"); |
|
708 |
|
|
709 |
|
|
710 |
/********************************************************** |
|
711 |
* - End of upgrade script |
|
712 |
*/ |
|
600 | 713 |
echo "<br /><br />Done<br />"; |
601 | 714 |
|
602 | 715 |
?> |
603 | 716 |
|
604 | 717 |
</body> |
605 |
</html> |
|
718 |
</html> |
Also available in: Unified diff
Updated upgrade script