<?php
-define( 'UPDATE_VERSION' , 1159 );
+define( 'UPDATE_VERSION' , 1173 );
/**
*
* copying the latest files from the source code repository will always perform a clean
* and painless upgrade.
*
- * Each function in this file is named update_nnnn() where nnnn is an increasing number
+ * Each function in this file is named update_nnnn() where nnnn is an increasing number
* which began counting at 1000.
- *
+ *
* At the top of the file "boot.php" is a define for DB_UPDATE_VERSION. Any time there is a change
* to the database schema or one which requires an upgrade path from the existing application,
* the DB_UPDATE_VERSION and the UPDATE_VERSION at the top of this file are incremented.
*
* The current DB_UPDATE_VERSION is stored in the config area of the database. If the application starts up
- * and DB_UPDATE_VERSION is greater than the last stored build number, we will process every update function
- * in order from the currently stored value to the new DB_UPDATE_VERSION. This is expected to bring the system
+ * and DB_UPDATE_VERSION is greater than the last stored build number, we will process every update function
+ * in order from the currently stored value to the new DB_UPDATE_VERSION. This is expected to bring the system
* up to current without requiring re-installation or manual intervention.
*
* Once the upgrade functions have completed, the current DB_UPDATE_VERSION is stored as the current value.
- * The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file.
+ * The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file.
*
* If you change the database schema, the following are required:
- * 1. Update the file database.sql to match the new schema.
- * 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
- * This function should modify the current database schema and perform any other steps necessary
- * to ensure that upgrade is silent and free from requiring interaction.
+ * 1. Update the file include/dbstructure.php to match the new schema.
+ * 2. If there is a need for a post procession, update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION.
+ * This function should perform some post procession steps but no database updates.
* 3. Increment the DB_UPDATE_VERSION in boot.php *AND* the UPDATE_VERSION in this file to match it
* 4. TEST the upgrade prior to checkin and filing a pull request.
*
+ * IMPORTANT!
+ * NEVER do a database change anymore in the update functions! Only do this in the file include/dbstructure.php!
*/
q("ALTER TABLE `intro` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `knowyou` ");
q("ALTER TABLE `contact` ADD `duplex` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `rel` ");
- q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
+ q("ALTER TABLE `contact` CHANGE `issued-pubkey` `issued-pubkey` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL");
q("ALTER TABLE `contact` ADD `term-date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `avatar-date`");
}
function update_1001() {
q("ALTER TABLE `item` ADD `wall` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `type` ");
- q("ALTER TABLE `item` ADD INDEX ( `wall` )");
+ q("ALTER TABLE `item` ADD INDEX ( `wall` )");
}
function update_1002() {
q("ALTER TABLE `contact` DROP `issued-pubkey` , DROP `ret-id` , DROP `ret-pubkey` ");
q("ALTER TABLE `contact` ADD `usehub` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `ret-aes`");
q("ALTER TABLE `contact` ADD `hub-verify` CHAR( 255 ) NOT NULL AFTER `usehub`");
- q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
+ q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
q("ALTER TABLE `contact` ADD INDEX ( `blocked` ), ADD INDEX ( `readonly` )");
}
$spkey = openssl_pkey_get_details($sres);
$spubkey = $spkey["key"];
$r = q("UPDATE `user` SET `spubkey` = '%s', `sprvkey` = '%s'
- WHERE `uid` = %d LIMIT 1",
+ WHERE `uid` = %d",
dbesc($spubkey),
dbesc($sprvkey),
intval($rr['uid'])
function update_1007() {
q("ALTER TABLE `user` ADD `page-flags` INT NOT NULL DEFAULT '0' AFTER `notify-flags`");
- q("ALTER TABLE `user` ADD INDEX ( `nickname` )");
+ q("ALTER TABLE `user` ADD INDEX ( `nickname` )");
}
function update_1008() {
$r = q("SELECT * FROM `contact` WHERE 1");
if(count($r)) {
foreach($r as $rr) {
- q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d LIMIT 1",
+ q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d",
dbesc(basename($rr['url'])),
intval($rr['id'])
);
}
function update_1013() {
- q("ALTER TABLE `item` ADD `target-type` CHAR( 255 ) NOT NULL
+ q("ALTER TABLE `item` ADD `target-type` CHAR( 255 ) NOT NULL
AFTER `object` , ADD `target` TEXT NOT NULL AFTER `target-type`");
-}
+}
function update_1014() {
require_once('include/Photo.php');
}
$r = q("SELECT * FROM `contact` WHERE 1");
if(count($r)) {
- foreach($r as $rr) {
+ foreach($r as $rr) {
if(stristr($rr['thumb'],'avatar'))
- q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d LIMIT 1",
+ q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d",
dbesc(str_replace('avatar','micro',$rr['thumb'])),
intval($rr['id']));
else
- q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d LIMIT 1",
+ q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d",
dbesc(str_replace('5.jpg','6.jpg',$rr['thumb'])),
intval($rr['id']));
}
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` CHAR( 255 ) NOT NULL ,
`version` CHAR( 255 ) NOT NULL ,
- `installed` TINYINT( 1 ) NOT NULL DEFAULT '0'
+ `installed` TINYINT( 1 ) NOT NULL DEFAULT '0'
) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
}
if($r && count($r)) {
foreach($r as $rr) {
if(strstr($rr['object'],'type="http')) {
- q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d LIMIT 1",
+ q("UPDATE `item` SET `object` = '%s' WHERE `id` = %d",
dbesc(str_replace('type="http','href="http',$rr['object'])),
intval($rr['id'])
);
}
}
}
-
+
function update_1032() {
q("ALTER TABLE `profile` ADD `pdesc` CHAR( 255 ) NOT NULL AFTER `name` ");
}
function update_1034() {
- // If you have any of these parent-less posts they can cause problems, and
+ // If you have any of these parent-less posts they can cause problems, and
// we need to delete them. You can't see them anyway.
- // Legitimate items will usually get re-created on the next
+ // Legitimate items will usually get re-created on the next
// pull from the hub.
- // But don't get rid of a post that may have just come in
+ // But don't get rid of a post that may have just come in
// and may not yet have the parent id set.
q("DELETE FROM `item` WHERE `parent` = 0 AND `created` < UTC_TIMESTAMP() - INTERVAL 2 MINUTE");
$r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' ");
if(count($r)) {
foreach($r as $rr) {
- q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d LIMIT 1",
+ q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
dbesc(str_replace('include/photo','photo',$rr['photo'])),
dbesc(str_replace('include/photo','photo',$rr['thumb'])),
dbesc(str_replace('include/photo','photo',$rr['micro'])),
`url` CHAR( 255 ) NOT NULL ,
`photo` CHAR( 255 ) NOT NULL ,
`note` TEXT NOT NULL ,
- `created` DATETIME NOT NULL
+ `created` DATETIME NOT NULL
) ENGINE = MYISAM DEFAULT CHARSET=utf8");
}
$r = q("SELECT `uid` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 1");
if(count($r)) {
foreach($r as $rr)
- q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d LIMIT 1",
+ q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d",
intval($rr['uid'])
);
}
$found = false;
} while ($found == true );
- q("UPDATE `user` SET `guid` = '%s' WHERE `uid` = %d LIMIT 1",
+ q("UPDATE `user` SET `guid` = '%s' WHERE `uid` = %d",
dbesc($guid),
intval($rr['uid'])
);
}
// 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
+// 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
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");
+ q("ALTER TABLE `guid` CHANGE `guid` `guid` CHAR( 64 ) NOT NULL");
}
function update_1078() {
ADD `network` CHAR( 32 ) NOT NULL ,
ADD `alias` CHAR( 255 ) NOT NULL ,
ADD `pubkey` TEXT NOT NULL ,
- ADD INDEX ( `addr` ) ,
+ ADD INDEX ( `addr` ) ,
ADD INDEX ( `network` ) ");
}
intval($rr['id'])
);
if(count($x))
- q("UPDATE `item` SET `commented` = '%s' WHERE `id` = %d LIMIT 1",
+ q("UPDATE `item` SET `commented` = '%s' WHERE `id` = %d",
dbesc($x[0]['cdate']),
intval($rr['id'])
);
}
function update_1097() {
- q("ALTER TABLE `queue`
- ADD INDEX (`cid`),
- ADD INDEX (`created`),
- ADD INDEX (`last`),
- ADD INDEX (`network`),
- ADD INDEX (`batch`)
+ q("ALTER TABLE `queue`
+ ADD INDEX (`cid`),
+ ADD INDEX (`created`),
+ ADD INDEX (`last`),
+ ADD INDEX (`network`),
+ ADD INDEX (`batch`)
");
}
function update_1098() {
- q("ALTER TABLE `contact`
- ADD INDEX (`network`),
- ADD INDEX (`name`),
- ADD INDEX (`nick`),
- ADD INDEX (`attag`),
+ q("ALTER TABLE `contact`
+ ADD INDEX (`network`),
+ ADD INDEX (`name`),
+ ADD INDEX (`nick`),
+ ADD INDEX (`attag`),
ADD INDEX (`url`),
- ADD INDEX (`addr`),
- ADD INDEX (`batch`)
+ ADD INDEX (`addr`),
+ ADD INDEX (`batch`)
");
}
q("ALTER TABLE `gcontact` ADD INDEX (`nurl`) ");
q("ALTER TABLE `glink` ADD INDEX (`cid`), ADD INDEX (`uid`), ADD INDEX (`gcid`), ADD INDEX (`updated`) ");
- q("ALTER TABLE `contact` ADD `poco` TEXT NOT NULL AFTER `confirm` ");
+ q("ALTER TABLE `contact` ADD `poco` TEXT NOT NULL AFTER `confirm` ");
}
$r = q("select id, url from contact where url != '' and nurl = '' ");
if(count($r)) {
foreach($r as $rr) {
- q("update contact set nurl = '%s' where id = %d limit 1",
+ q("update contact set nurl = '%s' where id = %d",
dbesc(normalise_link($rr['url'])),
intval($rr['id'])
- );
+ );
}
}
}
}
function update_1102() {
- q("ALTER TABLE `clients` ADD `name` TEXT NULL DEFAULT NULL AFTER `redirect_uri` ");
- q("ALTER TABLE `clients` ADD `icon` TEXT NULL DEFAULT NULL AFTER `name` ");
- q("ALTER TABLE `clients` ADD `uid` INT NOT NULL DEFAULT 0 AFTER `icon` ");
+ q("ALTER TABLE `clients` ADD `name` TEXT NULL DEFAULT NULL AFTER `redirect_uri` ");
+ q("ALTER TABLE `clients` ADD `icon` TEXT NULL DEFAULT NULL AFTER `name` ");
+ q("ALTER TABLE `clients` ADD `uid` INT NOT NULL DEFAULT 0 AFTER `icon` ");
- q("ALTER TABLE `tokens` ADD `secret` TEXT NOT NULL AFTER `id` ");
- q("ALTER TABLE `tokens` ADD `uid` INT NOT NULL AFTER `scope` ");
+ q("ALTER TABLE `tokens` ADD `secret` TEXT NOT NULL AFTER `id` ");
+ q("ALTER TABLE `tokens` ADD `uid` INT NOT NULL AFTER `scope` ");
}
function update_1103() {
// q("ALTER TABLE `item` ADD INDEX ( `wall` ) ");
- q("ALTER TABLE `item` ADD FULLTEXT ( `tag` ) ");
+ q("ALTER TABLE `item` ADD FULLTEXT ( `tag` ) ");
q("ALTER TABLE `contact` ADD INDEX ( `pending` ) ");
q("ALTER TABLE `user` ADD INDEX ( `hidewall` ) ");
q("ALTER TABLE `user` ADD INDEX ( `blockwall` ) ");
}
-function update_1108() {
+function update_1108() {
q("ALTER TABLE `contact` ADD `hidden` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `writable` ,
ADD INDEX ( `hidden` ) ");
}
function update_1115() {
- q("ALTER TABLE `item` ADD `moderated`
- TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `pubmail`,
+ q("ALTER TABLE `item` ADD `moderated`
+ TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `pubmail`,
ADD INDEX (`moderated`) ");
}
}
function update_1135() {
- //there can't be indexes with more than 1000 bytes in mysql,
+ //there can't be indexes with more than 1000 bytes in mysql,
//so change charset to be smaller
q("ALTER TABLE `config` CHANGE `cat` `cat` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL ,
-CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
-
+CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
+
//same thing for pconfig
q("ALTER TABLE `pconfig` CHANGE `cat` `cat` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL ,
- CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
+ CHANGE `k` `k` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL");
// faulty update merged forward. Bad update in 1134 caused duplicate k,cat pairs
- // these have to be cleared before the unique keys can be added.
+ // these have to be cleared before the unique keys can be added.
}
function update_1136() {
foreach($arr as $x) {
if($x['cat'] == $rr['cat'] && $x['k'] == $rr['k']) {
$found = true;
- q("delete from config where id = %d limit 1",
+ q("delete from config where id = %d",
intval($rr['id'])
);
}
}
}
}
-
+
$arr = array();
$r = q("select * from pconfig where 1 order by id desc");
if(count($r)) {
foreach($arr as $x) {
if($x['uid'] == $rr['uid'] && $x['cat'] == $rr['cat'] && $x['k'] == $rr['k']) {
$found = true;
- q("delete from pconfig where id = %d limit 1",
+ q("delete from pconfig where id = %d",
intval($rr['id'])
);
}
}
}
}
- q("ALTER TABLE `config` ADD UNIQUE `access` ( `cat` , `k` ) ");
- q("ALTER TABLE `pconfig` ADD UNIQUE `access` ( `uid` , `cat` , `k` )");
+ q("ALTER TABLE `config` ADD UNIQUE `access` ( `cat` , `k` ) ");
+ q("ALTER TABLE `pconfig` ADD UNIQUE `access` ( `uid` , `cat` , `k` )");
}
function update_1147() {
$r1 = q("ALTER TABLE `sign` ALTER `iid` SET DEFAULT '0'");
$r2 = q("ALTER TABLE `sign` ADD `retract_iid` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `iid`");
- $r3 = q("ALTER TABLE `sign` ADD INDEX ( `retract_iid` )");
+ $r3 = q("ALTER TABLE `sign` ADD INDEX ( `retract_iid` )");
if((! $r1) || (! $r2) || (! $r3))
return UPDATE_FAILED ;
return UPDATE_SUCCESS ;
`otype` TINYINT( 3 ) UNSIGNED NOT NULL ,
`type` TINYINT( 3 ) UNSIGNED NOT NULL ,
`term` CHAR( 255 ) NOT NULL ,
- `url` CHAR( 255 ) NOT NULL,
+ `url` CHAR( 255 ) NOT NULL,
KEY `oid` ( `oid` ),
KEY `otype` ( `otype` ),
KEY `type` ( `type` ),
function update_1153() {
$r = q("ALTER TABLE `hook` ADD `priority` INT(11) UNSIGNED NOT NULL DEFAULT '0'");
-
+
if(!$r) return UPDATE_FAILED;
return UPDATE_SUCCESS;
}
}
function update_1157() {
-<<<<<<< HEAD
- $r = q("ALTER TABLE `term` ADD `aid` int(10) unsigned NOT NULL DEFAULT '0',
- ADD `uid` int(10) unsigned NOT NULL DEFAULT '0',
- ADD INDEX (`uid`),
- ADD INDEX (`aid`)");
-
- if(!$r) return UPDATE_FAILED;
- return UPDATE_SUCCESS;
-}
-function update_1158() {
$r = q("CREATE TABLE IF NOT EXISTS `dsprphotoq` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
) ENGINE=MyISAM DEFAULT CHARSET=utf8"
);
+ if($r)
+ return UPDATE_SUCCESS;
+}
+
+function update_1158() {
+ set_config('system', 'maintenance', 1);
+
+ // Wait for 15 seconds for current requests to
+ // clear before locking up the database
+ sleep(15);
+
+ $r = q("CREATE INDEX event_id ON item(`event-id`)");
+ set_config('system', 'maintenance', 0);
+
if($r)
return UPDATE_SUCCESS;
ADD INDEX (`uid`),
ADD INDEX (`aid`)");
- if(!$r) return UPDATE_FAILED;
+ if(!$r)
+ return UPDATE_FAILED;
+
return UPDATE_SUCCESS;
}
function update_1160() {
+ set_config('system', 'maintenance', 1);
+
+ // Wait for 15 seconds for current requests to
+ // clear before locking up the database
+ sleep(15);
+
$r = q("ALTER TABLE `item` ADD `mention` TINYINT(1) NOT NULL DEFAULT '0', ADD INDEX (`mention`)");
-// KEY `mention` (`mention`)
- if(!$r) return UPDATE_FAILED;
+ set_config('system', 'maintenance', 0);
+
+ if(!$r)
+ return UPDATE_FAILED;
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1161() {
+ $r = q("ALTER TABLE `pconfig` ADD INDEX (`cat`)");
+
+ if(!$r)
+ return UPDATE_FAILED;
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1162() {
+ require_once('include/tags.php');
+ update_items();
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1163() {
+ set_config('system', 'maintenance', 1);
+
+ $r = q("ALTER TABLE `item` ADD `network` char(32) NOT NULL");
+
+ set_config('system', 'maintenance', 0);
+ if(!$r)
+ return UPDATE_FAILED;
+
+ return UPDATE_SUCCESS;
+}
+function update_1164() {
+ set_config('system', 'maintenance', 1);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_DFRN);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_DFRN, NETWORK_DFRN);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_ZOT, NETWORK_ZOT);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_OSTATUS, NETWORK_OSTATUS);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_FEED, NETWORK_FEED);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_DIASPORA, NETWORK_DIASPORA);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_MAIL, NETWORK_MAIL);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_MAIL2, NETWORK_MAIL2);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_FACEBOOK, NETWORK_FACEBOOK);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_LINKEDIN, NETWORK_LINKEDIN);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_XMPP, NETWORK_XMPP);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_MYSPACE, NETWORK_MYSPACE);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_GPLUS, NETWORK_GPLUS);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_PUMPIO, NETWORK_PUMPIO);
+
+ $r = q("UPDATE `item` SET `network`='%s' WHERE `contact-id` IN (SELECT `id` FROM`contact` WHERE `network` = '%s' AND `contact`.`uid` = `item`.`uid`)",
+ NETWORK_TWITTER, NETWORK_TWITTER);
+
+ set_config('system', 'maintenance', 0);
+
return UPDATE_SUCCESS;
}
+
+function update_1165() {
+ $r = q("CREATE TABLE IF NOT EXISTS `push_subscriber` (
+ `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ `uid` INT NOT NULL,
+ `callback_url` CHAR( 255 ) NOT NULL,
+ `topic` CHAR( 255 ) NOT NULL,
+ `nickname` CHAR( 255 ) NOT NULL,
+ `push` INT NOT NULL,
+ `last_update` DATETIME NOT NULL,
+ `secret` CHAR( 255 ) NOT NULL
+ ) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
+ if (!$r)
+ return UPDATE_FAILED;
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1166() {
+ $r = q("CREATE TABLE IF NOT EXISTS `unique_contacts` (
+ `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ `url` CHAR(255) NOT NULL,
+ `nick` CHAR(255) NOT NULL,
+ `name` CHAR(255) NOT NULL,
+ `avatar` CHAR(255) NOT NULL,
+ INDEX (`url`)
+ ) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
+ if (!$r)
+ return UPDATE_FAILED;
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1167() {
+ $r = q("ALTER TABLE `contact` ADD `notify_new_posts` TINYINT(1) NOT NULL DEFAULT '0'");
+ if (!$r)
+ return UPDATE_FAILED;
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1168() {
+ $r = q("ALTER TABLE `contact` ADD `fetch_further_information` TINYINT(1) NOT NULL DEFAULT '0'");
+ if (!$r)
+ return UPDATE_FAILED;
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1169() {
+ $r = q("CREATE TABLE IF NOT EXISTS `thread` (
+ `iid` int(10) unsigned NOT NULL DEFAULT '0',
+ `uid` int(10) unsigned NOT NULL DEFAULT '0',
+ `contact-id` int(11) unsigned NOT NULL DEFAULT '0',
+ `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `edited` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `received` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `changed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `wall` tinyint(1) NOT NULL DEFAULT '0',
+ `private` tinyint(1) NOT NULL DEFAULT '0',
+ `pubmail` tinyint(1) NOT NULL DEFAULT '0',
+ `moderated` tinyint(1) NOT NULL DEFAULT '0',
+ `visible` tinyint(1) NOT NULL DEFAULT '0',
+ `spam` tinyint(1) NOT NULL DEFAULT '0',
+ `starred` tinyint(1) NOT NULL DEFAULT '0',
+ `bookmark` tinyint(1) NOT NULL DEFAULT '0',
+ `unseen` tinyint(1) NOT NULL DEFAULT '1',
+ `deleted` tinyint(1) NOT NULL DEFAULT '0',
+ `origin` tinyint(1) NOT NULL DEFAULT '0',
+ `forum_mode` tinyint(1) NOT NULL DEFAULT '0',
+ `mention` tinyint(1) NOT NULL DEFAULT '0',
+ `network` char(32) NOT NULL,
+ PRIMARY KEY (`iid`),
+ KEY `created` (`created`),
+ KEY `commented` (`commented`),
+ KEY `uid_network_commented` (`uid`,`network`,`commented`),
+ KEY `uid_network_created` (`uid`,`network`,`created`),
+ KEY `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
+ KEY `uid_contactid_created` (`uid`,`contact-id`,`created`),
+ KEY `wall_private_received` (`wall`,`private`,`received`),
+ KEY `uid_created` (`uid`,`created`),
+ KEY `uid_commented` (`uid`,`commented`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
+ if (!$r)
+ return UPDATE_FAILED;
+
+ proc_run('php',"include/threadupdate.php");
+
+ return UPDATE_SUCCESS;
+}
+
+/*
+==========
+ATTENTION!
+==========
+
+All following update functions are ONLY for jobs that need to run AFTER the database changes are applied.
+
+Database changes are ONLY applied in the file include/dbstructure.php.
+*/