Revision 2104
Added by darkviper about 10 years ago
upgrade-script.php | ||
---|---|---|
86 | 86 |
$oDb = WbDatabase::getInstance(); |
87 | 87 |
$oReg = WbAdaptor::getInstance(); |
88 | 88 |
UpgradeHelper::checkSetupFiles(str_replace('\\', '/', __DIR__).'/'); |
89 |
// --- modify table `settings` ----------------------------------------------------------- |
|
90 |
$oDb->removeField($oDb->TablePrefix.'settings', 'setting_id'); |
|
91 |
$oDb->addIndex($oDb->TablePrefix.'settings', 'PRIMARY', 'name', 'PRIMARY'); |
|
89 | 92 |
// --- set DEFAULT_THEME and restart if needed ------------------------------------------- |
90 | 93 |
if (isset($oReg->DefaultTheme) && trim($oReg->DefaultTheme, '/') != 'WbTheme') { |
91 | 94 |
db_update_key_value('settings', 'default_theme', 'WbTheme'); |
... | ... | |
128 | 131 |
if(!defined('WB_REVISION')) { define('WB_REVISION',''); } |
129 | 132 |
// database tables including in WB package |
130 | 133 |
$aPackage = array ( |
131 |
'settings','groups','addons','pages','sections','search','users', |
|
132 |
'mod_captcha_control','mod_jsadmin','mod_menu_link','mod_output_filter','mod_wrapper','mod_wysiwyg' |
|
134 |
'settings','groups','addons','pages','sections','search','users' |
|
133 | 135 |
); |
134 | 136 |
|
135 | 137 |
$OK = ' <span class="ok">OK</span> '; |
... | ... | |
768 | 770 |
$aDebugMessage[] = "<span>Modify field publ_end on sections table</span>"; |
769 | 771 |
$aDebugMessage[] = ($database->field_modify($table_name, 'publ_end', $description) ? " $OK<br />" : " $FAIL!<br />"); |
770 | 772 |
|
773 |
/********************************************************** |
|
774 |
* - Add field "title" to table sections |
|
775 |
*/ |
|
776 |
$table_name = TABLE_PREFIX.'sections'; |
|
777 |
$field_name = 'title'; |
|
778 |
$description = "VARCHAR( 255 ) NOT NULL DEFAULT 'Section-ID 0' "; |
|
779 |
add_modify_field_in_database($table_name,$field_name,$description); |
|
780 |
|
|
771 | 781 |
if($bDebugModus) { |
772 | 782 |
echo implode(PHP_EOL,$aDebugMessage); |
773 | 783 |
} else { |
... | ... | |
792 | 802 |
$sSystemPermissions .= 'modules,modules_advanced,modules_install,modules_uninstall,modules_view,pages,pages_add,pages_add_l0,pages_delete,pages_intro,pages_modify,pages_settings,pages_view,'; |
793 | 803 |
$sSystemPermissions .= 'preferences,preferences_view,settings,settings_advanced,settings_basic,settings_view,templates,templates_install,templates_uninstall,templates_view,users,users_add,users_delete,users_modify,users_view'; |
794 | 804 |
|
795 |
$sql = 'UPDATE `'.TABLE_PREFIX.'groups` ';
|
|
796 |
$sql .= 'SET `name` = \'Administrators\', ';
|
|
797 |
$sql .= '`system_permissions` = \''.$sSystemPermissions.'\', ';
|
|
798 |
$sql .= '`module_permissions` = \''.$sModulePermissions.'\', ';
|
|
799 |
$sql .= '`template_permissions` = \''.$sTemplatePermissions.'\' ';
|
|
800 |
$sql .= 'WHERE `group_id` = \'1\' ';
|
|
805 |
$sql = 'UPDATE `'.TABLE_PREFIX.'groups` '
|
|
806 |
. 'SET `name` = \'Administrators\', '
|
|
807 |
. '`system_permissions` = \''.$sSystemPermissions.'\', '
|
|
808 |
. '`module_permissions` = \''.$sModulePermissions.'\', '
|
|
809 |
. '`template_permissions` = \''.$sTemplatePermissions.'\' '
|
|
810 |
. 'WHERE `group_id` = \'1\' ';
|
|
801 | 811 |
$aDebugMessage[] = ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />"; |
802 | 812 |
if( ($admin->is_authenticated() == true) && ($admin->ami_group_member('1') ) ) { |
803 | 813 |
$_SESSION['SYSTEM_PERMISSIONS'] = array_merge($_SESSION['SYSTEM_PERMISSIONS'], explode(',', $sSystemPermissions)); |
Also available in: Unified diff
! complete rebuild of wb/install/ - changed to use import-struct.sql
! change class WbDatabase from mysql to msqli
! rework of WbDatabase::importSql()
! function db_update_key_value() optimized for speed
! field `settings_id`removed from table `settings` and new primary key set to `name`
! update-script extended to modify table `settings`