diff options
Diffstat (limited to 'install/update.php')
-rw-r--r-- | install/update.php | 295 |
1 files changed, 289 insertions, 6 deletions
diff --git a/install/update.php b/install/update.php index c40dd1982..c09bc9d64 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1031 ); +define( 'UPDATE_VERSION' , 1058 ); /** * @@ -52,7 +52,7 @@ function update_r1001() { `meta` CHAR( 255 ) NOT NULL DEFAULT '', `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY ( `id` ) - ) ENGINE = MYISAM "); + ) ENGINE = MYISAM DEFAULT CHARSET=utf8"); $r2 = q("alter table `verify` add index (`channel`), add index (`type`), add index (`token`), add index (`meta`), add index (`created`)"); @@ -91,7 +91,7 @@ function update_r1004() { `site_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `site_directory` CHAR( 255 ) NOT NULL DEFAULT '', PRIMARY KEY ( `site_url` ) -) ENGINE = MYISAM "); +) ENGINE = MYISAM DEFAULT CHARSET=utf8"); $r2 = q("alter table site add index (site_flags), add index (site_update), add index (site_directory) "); @@ -204,7 +204,7 @@ function update_r1013() { `xlink_xchan` CHAR( 255 ) NOT NULL DEFAULT '', `xlink_link` CHAR( 255 ) NOT NULL DEFAULT '', `xlink_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' -) ENGINE = MYISAM "); +) ENGINE = MYISAM DEFAULT CHARSET=utf8"); $r2 = q("alter table xlink add index ( xlink_xchan ), add index ( xlink_link ), add index ( xlink_updated ) "); if($r && $r2) @@ -367,7 +367,7 @@ ADD INDEX ( `channel_deleted` ) "); } function update_r1030() { - $r = q("CREATE TABLE IF NOT EXISTS`issue` ( + $r = q("CREATE TABLE IF NOT EXISTS `issue` ( `issue_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `issue_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `issue_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -381,9 +381,292 @@ KEY `issue_assigned` (`issue_assigned`), KEY `issue_priority` (`issue_priority`), KEY `issue_status` (`issue_status`), KEY `issue_component` (`issue_component`) -) ENGINE = MYISAM "); +) ENGINE = MYISAM DEFAULT CHARSET=utf8"); if($r) return UPDATE_SUCCESS; return UPDATE_FAILED; } + +function update_r1031() { + $r = q("ALTER TABLE `account` ADD `account_external` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `account_email` , +ADD INDEX ( `account_external` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +function update_r1032() { + $r = q("CREATE TABLE if not exists `xign` ( +`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`uid` INT NOT NULL DEFAULT '0', +`xchan` CHAR( 255 ) NOT NULL DEFAULT '', +KEY `uid` (`uid`), +KEY `xchan` (`xchan`) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1033() { + $r = q("CREATE TABLE if not exists `shares` ( +`share_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`share_type` INT NOT NULL DEFAULT '0', +`share_target` INT UNSIGNED NOT NULL DEFAULT '0', +`share_xchan` CHAR( 255 ) NOT NULL DEFAULT '', +KEY `share_type` (`share_type`), +KEY `share_target` (`share_target`), +KEY `share_xchan` (`share_xchan`) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + // if these fail don't bother reporting it + + q("drop table gcign"); + q("drop table gcontact"); + q("drop table glink"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1034() { + $r = q("CREATE TABLE if not exists `updates` ( +`ud_hash` CHAR( 128 ) NOT NULL , +`ud_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', +PRIMARY KEY ( `ud_hash` ), +KEY `ud_date` ( `ud_date` ) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1035() { + $r = q("CREATE TABLE if not exists `xconfig` ( +`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , +`xchan` CHAR( 255 ) NOT NULL , +`cat` CHAR( 255 ) NOT NULL , +`k` CHAR( 255 ) NOT NULL , +`v` MEDIUMTEXT NOT NULL, +KEY `xchan` ( `xchan` ), +KEY `cat` ( `cat` ), +KEY `k` ( `k` ) +) ENGINE = MYISAM DEFAULT CHARSET = utf8"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1036() { + $r = q("ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +function update_r1037() { + $r1 = q("ALTER TABLE `item` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '', +CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '', + DROP INDEX `uri` , +ADD INDEX `mid` ( `mid` ), +DROP INDEX `parent_uri` , +ADD INDEX `parent_mid` ( `parent_mid` ), + DROP INDEX `uid_uri` , +ADD INDEX `uid_mid` ( `mid` , `uid` ) "); + + $r2 = q("ALTER TABLE `mail` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , +CHANGE `parent_uri` `parent_mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , +DROP INDEX `uri` , +ADD INDEX `mid` ( `mid` ), + DROP INDEX `parent_uri` , +ADD INDEX `parent_mid` ( `parent_mid` ) "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +function update_r1038() { + $r = q("ALTER TABLE `manage` CHANGE `mid` `xchan` CHAR( 255 ) NOT NULL DEFAULT '', drop index `mid`, ADD INDEX ( `xchan` )"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + + +function update_r1039() { + $r = q("ALTER TABLE `channel` CHANGE `channel_default_gid` `channel_default_group` CHAR( 255 ) NOT NULL DEFAULT ''"); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; + +} + +function update_r1040() { + $r1 = q("ALTER TABLE `session` CHANGE `expire` `expire` BIGINT UNSIGNED NOT NULL "); + $r2 = q("ALTER TABLE `tokens` CHANGE `expires` `expires` BIGINT UNSIGNED NOT NULL "); + + if($r1 && $r2) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1041() { + $r = q("ALTER TABLE `outq` ADD `outq_driver` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `outq_channel` "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +function update_r1042() { + $r = q("ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', +ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` )"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +function update_r1043() { + $r = q("ALTER TABLE `item` ADD `comment_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` , +ADD INDEX ( `comment_policy` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1044() { + $r = q("ALTER TABLE `term` ADD `imgurl` CHAR( 255 ) NOT NULL , +ADD INDEX ( `imgurl` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1045() { + $r = q("ALTER TABLE `site` ADD `site_register` INT NOT NULL DEFAULT '0', +ADD INDEX ( `site_register` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1046() { + $r = q("ALTER TABLE `term` ADD `term_hash` CHAR( 255 ) NOT NULL DEFAULT '', +ADD INDEX ( `term_hash` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1047() { + $r = q("ALTER TABLE `xprof` ADD `xprof_age` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `xprof_hash` , +ADD INDEX ( `xprof_age` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1048() { + $r = q("CREATE TABLE IF NOT EXISTS `obj` ( + `obj_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `obj_page` char(64) NOT NULL DEFAULT '', + `obj_verb` char(255) NOT NULL DEFAULT '', + `obj_type` int(10) unsigned NOT NULL DEFAULT '0', + `obj_obj` char(255) NOT NULL DEFAULT '', + `obj_channel` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`obj_id`), + KEY `obj_verb` (`obj_verb`), + KEY `obj_page` (`obj_page`), + KEY `obj_type` (`obj_type`), + KEY `obj_channel` (`obj_channel`), + KEY `obj_obj` (`obj_obj`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +function update_r1049() { + $r = q("ALTER TABLE `term` ADD `parent_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `term_hash` , ADD INDEX ( `parent_hash` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1050() { + $r = q("ALTER TABLE `xtag` DROP PRIMARY KEY , ADD `xtag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST , ADD INDEX ( `xtag_hash` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1051() { + $r = q("ALTER TABLE `photo` ADD `photo_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `profile` , ADD INDEX ( `photo_flags` ) "); + + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + + +function update_r1052() { + $r = q("ALTER TABLE `channel` ADD UNIQUE (`channel_address`) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1053() { + $r = q("ALTER TABLE `profile` ADD `chandesc` TEXT NOT NULL DEFAULT '' AFTER `pdesc` "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1054() { + $r = q("ALTER TABLE `item` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1055() { + $r = q("ALTER TABLE `mail` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1056() { + $r = q("ALTER TABLE `xchan` ADD `xchan_instance_url` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_network` , +ADD INDEX ( `xchan_instance_url` ) "); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} + +function update_r1057() { + $r = q("drop table intro"); + if($r) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} |