Revision 720
Added by doc almost 17 years ago
upgrade-script.php | ||
---|---|---|
143 | 143 |
.error { color:red; } |
144 | 144 |
.check { color:#555; } |
145 | 145 |
|
146 |
.red { background-color:#FF0000 } |
|
147 |
.green { background-color:#00FF00 } |
|
148 |
|
|
149 | 146 |
.warning { |
150 | 147 |
width: 98%; |
151 | 148 |
background:#FFDBDB; |
... | ... | |
201 | 198 |
<p>will upgrade Website Baker 2.6.5 / 2.6.7 to version 2.7</p> |
202 | 199 |
<?php |
203 | 200 |
|
204 |
$OK = '<span class="green">OK</span>';
|
|
205 |
$FAIL = '<span class="red">failed</span>';
|
|
201 |
$OK = '<span class="ok">OK</span>';
|
|
202 |
$FAIL = '<span class="error">FAILED</span>';
|
|
206 | 203 |
|
207 | 204 |
|
208 | 205 |
/********************************************************** |
... | ... | |
564 | 561 |
"); |
565 | 562 |
|
566 | 563 |
global $database; |
567 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('1','mod_jsadmin_persist_order','0')"); |
|
568 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('2','mod_jsadmin_ajax_order_pages','0')"); |
|
569 |
$database->query("INSERT INTO ".$table." (id,name,value) VALUES ('3','mod_jsadmin_ajax_order_sections','0')"); |
|
564 |
echo "Insert default value for mod_jsadmin_persist_order: "; |
|
565 |
echo ($database->query("INSERT INTO ".$table." (id,name,value) VALUES ('1','mod_jsadmin_persist_order','0')")) ? " $OK<br />" : " $FAIL<br />"; |
|
566 |
echo "Insert default value for mod_jsadmin_ajax_order_pages: "; |
|
567 |
echo ($database->query("INSERT INTO ".$table." (id,name,value) VALUES ('2','mod_jsadmin_ajax_order_pages','0')")) ? " $OK<br />" : " $FAIL<br />"; |
|
568 |
echo "Insert default value for mod_jsadmin_ajax_order_sections: "; |
|
569 |
echo ($database->query("INSERT INTO ".$table." (id,name,value) VALUES ('3','mod_jsadmin_ajax_order_sections','0')")) ? " $OK<br />" : " $FAIL<br />"; |
|
570 | 570 |
|
571 |
|
|
572 | 571 |
/********************************************************** |
573 | 572 |
* - Output Filter |
574 | 573 |
*/ |
575 |
echo "<br /><u>Adding table mod_outputfilter</u><br />"; |
|
574 |
echo "<br /><u>Adding table mod_outputfilter</u><br />Status: ";
|
|
576 | 575 |
$table = TABLE_PREFIX .'mod_output_filter'; |
577 | 576 |
$database->query("DROP TABLE IF EXISTS `$table`"); |
578 | 577 |
|
... | ... | |
585 | 584 |
); |
586 | 585 |
|
587 | 586 |
// add default values to the module table |
588 |
$database->query("INSERT INTO ".TABLE_PREFIX |
|
589 |
."mod_output_filter (email_filter, mailto_filter, at_replacement, dot_replacement) VALUES ('0', '0', '(at)', '(dot)')");
|
|
587 |
echo ($database->query("INSERT INTO ".TABLE_PREFIX
|
|
588 |
."mod_output_filter (email_filter, mailto_filter, at_replacement, dot_replacement) VALUES ('0', '0', '(at)', '(dot)')")) ? " $OK<br />" : " $FAIL<br />";
|
|
590 | 589 |
|
591 | 590 |
|
592 | 591 |
/********************************************************** |
593 | 592 |
* - Form Modul |
594 | 593 |
*/ |
594 |
echo '<br />'; |
|
595 | 595 |
db_add_field('success_email_subject', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`"); |
596 |
echo '<br />'; |
|
596 | 597 |
db_add_field('success_email_text', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`"); |
598 |
echo '<br />'; |
|
597 | 599 |
db_add_field('success_email_from', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`"); |
600 |
echo '<br />'; |
|
598 | 601 |
db_add_field('success_email_to', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`"); |
602 |
echo '<br />'; |
|
599 | 603 |
db_add_field('success_page', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`"); |
604 |
echo '<br />'; |
|
600 | 605 |
db_add_field('email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER email_from"); |
606 |
echo '<br />'; |
|
601 | 607 |
db_add_field('success_email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER success_email_from"); |
602 | 608 |
|
603 |
echo "<BR><B>Deleting field success_message from table mod_form_settings</B><BR>";
|
|
609 |
echo "<br /><b>Deleting field success_message from table mod_form_settings</b><br />";
|
|
604 | 610 |
|
605 | 611 |
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` DROP `success_message`")) { |
606 | 612 |
echo 'Database field success_message droped successfully<br>'; |
... | ... | |
743 | 749 |
echo mysql_error().'<br />'; |
744 | 750 |
} |
745 | 751 |
|
752 |
/********************************************************** |
|
753 |
* - Alter the WYSIWYG editor content from text to longtext |
|
754 |
*/ |
|
755 |
echo "<br /><u>Alter WYSIWYG editor content field from text to longtext</u><br />Status: "; |
|
756 |
echo ($database->query("ALTER TABLE ".TABLE_PREFIX."mod_wysiwyg MODIFY content LONGTEXT NOT NULL")) ?" $OK<br />" : " $FAIL<br />"; |
|
746 | 757 |
|
747 | 758 |
/********************************************************** |
748 | 759 |
* - Add Admintools to Administrator group |
749 | 760 |
*/ |
750 |
echo "<br /><u>Add Admintools to Adminsitrator group</u><br />"; |
|
761 |
echo "<br /><u>Add Admintools to Adminsitrator group</u><br />Status: ";
|
|
751 | 762 |
$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'; |
752 |
$database->query("UPDATE `".TABLE_PREFIX."groups` SET `system_permissions` = '$full_system_permissions' WHERE `name` = 'Administrators'");
|
|
763 |
echo ($database->query("UPDATE `".TABLE_PREFIX."groups` SET `system_permissions` = '$full_system_permissions' WHERE `name` = 'Administrators'")) ? " $OK<br />" : " $FAIL<br />";
|
|
753 | 764 |
|
754 |
|
|
755 | 765 |
/********************************************************** |
756 | 766 |
* - Add Mailer Settings to settings table |
757 | 767 |
*/ |
758 |
echo "<br /><u>Add Mailer Settings to settings table</u><br />"; |
|
768 |
echo "<br /><u>Add Mailer Settings to settings table</u><br />Status: ";
|
|
759 | 769 |
//delete rows to prevent double entries |
760 | 770 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_routine'"); |
761 | 771 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'server_email'"); |
... | ... | |
765 | 775 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_username'"); |
766 | 776 |
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_password'"); |
767 | 777 |
//add new rows with default values |
778 |
$wbmailer_smtp_host = (defined('WBMAILER_SMTP_HOST')) ? WBMAILER_SMTP_HOST : ''; |
|
779 |
$wbmailer_routine = ($wbmailer_smtp_host = '') ? 'phpmail' : 'smtp'; |
|
768 | 780 |
$settings_rows= "INSERT INTO `".TABLE_PREFIX."settings` " |
769 | 781 |
." (name, value) VALUES " |
770 |
." ('wbmailer_routine', 'phpmail'),"
|
|
782 |
." ('wbmailer_routine', '$wbmailer_routine'),"
|
|
771 | 783 |
." ('server_email', 'admin@yourdomain.com')," // avoid that mail provider (e.g. mail.com) reject mails like yourname@mail.com |
772 | 784 |
." ('wbmailer_default_sendername', 'WB Mailer')," |
773 |
." ('wbmailer_smtp_host', '')," |
|
785 |
." ('wbmailer_smtp_host', '$wbmailer_smtp_host'),"
|
|
774 | 786 |
." ('wbmailer_smtp_auth', '')," |
775 | 787 |
." ('wbmailer_smtp_username', '')," |
776 | 788 |
." ('wbmailer_smtp_password', '')"; |
777 |
$database->query($settings_rows);
|
|
789 |
echo ($database->query($settings_rows)) ? " $OK<br />" : " $FAIL<br />";
|
|
778 | 790 |
|
791 |
/********************************************************** |
|
792 |
* - Set Version to WB 2.7 |
|
793 |
*/ |
|
794 |
echo "<br /><u>Update database version number to 2.7</u><br />Status: "; |
|
795 |
$version = '2.7'; |
|
796 |
echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />"; |
|
779 | 797 |
|
780 | 798 |
/********************************************************** |
781 | 799 |
* - Reload all addons |
... | ... | |
821 | 839 |
echo '<br />Languages reloaded<br />'; |
822 | 840 |
|
823 | 841 |
/********************************************************** |
824 |
* - Set Version to WB 2.7 |
|
825 |
*/ |
|
826 |
echo "<br /><u>Set Version number to 2.7</u><br />"; |
|
827 |
$version = '2.7'; |
|
828 |
$database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'"); |
|
829 |
|
|
830 |
|
|
831 |
/********************************************************** |
|
832 | 842 |
* - End of upgrade script |
833 | 843 |
*/ |
834 |
echo "<br /><br />Done<br />";
|
|
844 |
echo "<p><strong>Upgrade script finished </strong></p><br />";
|
|
835 | 845 |
|
836 | 846 |
} |
837 | 847 |
?> |
Also available in: Unified diff
added WYSIWYG DB update and missing WBMAILER settings to upgrade script (added some status messages)