<?php
-define( 'UPDATE_VERSION' , 1076 );
+define( 'UPDATE_VERSION' , 1092 );
/**
*
);
}
}
-}
\ No newline at end of file
+}
+
+function update_1076() {
+ q("CREATE TABLE `guid` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `guid` CHAR( 16 ) NOT NULL , INDEX ( `guid` ) ) ENGINE = MYISAM ");
+
+}
+
+// There was a typo in 1076 so we'll try again in 1077 to make sure
+// We'll also make it big enough to allow for future growth, I seriously
+// doubt Diaspora will be able to leave guids at 16 bytes,
+// and we can also use the same structure for our own larger guids
+
+function update_1077() {
+ q("CREATE TABLE IF NOT EXISTS `guid` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `guid` CHAR( 16 ) NOT NULL , INDEX ( `guid` ) ) ENGINE = MYISAM ");
+
+ q("ALTER TABLE `guid` CHANGE `guid` `guid` CHAR( 64 ) NOT NULL");
+}
+
+function update_1078() {
+ q("ALTER TABLE `item` ADD `guid` CHAR( 64 ) NOT NULL AFTER `id` , ADD INDEX ( `guid` ) ");
+}
+
+function update_1079() {
+ q("CREATE TABLE IF NOT EXISTS `sign` (
+ `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `iid` INT UNSIGNED NOT NULL ,
+ `signed_text` MEDIUMTEXT NOT NULL ,
+ `signature` TEXT NOT NULL ,
+ `signer` CHAR( 255 ) NOT NULL ,
+ INDEX ( `iid` )
+ ) ENGINE = MYISAM ");
+
+ q("ALTER TABLE `fcontact` ADD `nick` CHAR( 255 ) NOT NULL ,
+ ADD `addr` CHAR( 255 ) NOT NULL ,
+ ADD `notify` CHAR( 255 ) NOT NULL ,
+ ADD `poll` CHAR( 255 ) NOT NULL ,
+ ADD `confirm` CHAR( 255 ) NOT NULL ,
+ ADD `priority` TINYINT( 1 ) NOT NULL ,
+ ADD `network` CHAR( 32 ) NOT NULL ,
+ ADD `alias` CHAR( 255 ) NOT NULL ,
+ ADD `pubkey` TEXT NOT NULL ,
+ ADD INDEX ( `addr` ) ,
+ ADD INDEX ( `network` ) ");
+
+}
+
+function update_1080() {
+ q("ALTER TABLE `fcontact` ADD `updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
+}
+
+function update_1081() {
+ // there was a typo in update 1081 so it was corrected and moved up to 1082
+}
+
+function update_1082() {
+ q("ALTER TABLE `photo` ADD `guid` CHAR( 64 ) NOT NULL AFTER `contact-id`,
+ ADD INDEX ( `guid` ) ");
+ // make certain the following code is only executed once
+ $r = q("select `id` from `photo` where `guid` != '' limit 1");
+ if($r && count($r))
+ return;
+ $r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`");
+ if(count($r)) {
+ foreach($r as $rr) {
+ $guid = get_guid();
+ q("update `photo` set `guid` = '%s' where `resource-id` = '%s'",
+ dbesc($guid),
+ dbesc($rr['resource-id'])
+ );
+ }
+ }
+}
+
+function update_1083() {
+ q("CREATE TABLE IF NOT EXISTS `deliverq` (
+ `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `cmd` CHAR( 32 ) NOT NULL ,
+ `item` INT NOT NULL ,
+ `contact` INT NOT NULL
+ ) ENGINE = MYISAM ");
+
+}
+
+function update_1084() {
+ q("ALTER TABLE `contact` ADD `attag` CHAR( 255 ) NOT NULL AFTER `nick` ");
+}
+
+function update_1085() {
+ q("CREATE TABLE IF NOT EXISTS `search` (
+ `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
+ `uid` INT NOT NULL ,
+ `term` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
+ INDEX ( `uid` ),
+ INDEX ( `term` )
+ ) ENGINE = MYISAM ");
+}
+
+function update_1086() {
+ q("ALTER TABLE `item` ADD `bookmark` tinyint(1) NOT NULL DEFAULT '0' AFTER `starred` ");
+}
+
+function update_1087() {
+ q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
+
+ $r = q("SELECT `id` FROM `item` WHERE `parent` = `id` ");
+ if(count($r)) {
+ foreach($r as $rr) {
+ $x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1",
+ intval($rr['id'])
+ );
+ if(count($x))
+ q("UPDATE `item` SET `commented` = '%s' WHERE `id` = %d LIMIT 1",
+ dbesc($x[0]['cdate']),
+ intval($rr['id'])
+ );
+ }
+ }
+}
+
+function update_1088() {
+ q("ALTER TABLE `user` ADD `account_expired` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `expire` ,
+ ADD `account_expires_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expired` ,
+ ADD `expire_notification_sent` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `account_expires_on` ");
+}
+
+function update_1089() {
+ q("ALTER TABLE `user` ADD `blocktags` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `hidewall` ");
+}
+
+function update_1090() {
+ q("ALTER TABLE `contact` ADD `batch` char(255) NOT NULL AFTER `prvkey` ");
+
+ q("UPDATE `contact` SET `batch` = concat(substring_index(`url`,'/',3),'/receive/public') WHERE `network` = 'dspr' ");
+
+}
+
+function update_1091() {
+
+ // catch a few stragglers that may have crept in before we added this on remote connects
+ q("UPDATE `contact` SET `batch` = concat(substring_index(`url`,'/',3),'/receive/public') WHERE `network` = 'dspr' AND `batch` = '' ");
+ q("ALTER TABLE `queue` ADD `batch` TINYINT( 1 ) NOT NULL DEFAULT '0' ");
+ q("ALTER TABLE `fcontact` ADD `batch` char(255) NOT NULL AFTER `addr` ");
+
+}
+