<?php
-define( 'UPDATE_VERSION' , 1173 );
+define('UPDATE_VERSION' , 1195);
/**
*
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` )");
}
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() {
}
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",
dbesc(str_replace('avatar','micro',$rr['thumb'])),
`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 ");
}
}
}
}
-
+
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");
`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");
}
}
// 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` ) ");
}
}
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` ");
}
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() {
}
}
}
-
+
$arr = array();
$r = q("select * from pconfig where 1 order by id desc");
if(count($r)) {
}
}
}
- 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_1163() {
set_config('system', 'maintenance', 1);
- $r = q("ALTER TABLE `item` ADD `network` char(32) NOT NULL,
- ADD INDEX (`network`)");
+ $r = q("ALTER TABLE `item` ADD `network` char(32) NOT NULL");
set_config('system', 'maintenance', 0);
-
if(!$r)
return UPDATE_FAILED;
Database changes are ONLY applied in the file include/dbstructure.php.
*/
+
+function update_1177() {
+ require_once("mod/profiles.php");
+
+ $profiles = q("SELECT `uid`, `about`, `locality`, `pub_keywords`, `gender` FROM `profile` WHERE `is-default`");
+
+ foreach ($profiles AS $profile) {
+ if ($profile["about"].$profile["locality"].$profile["pub_keywords"].$profile["gender"] == "")
+ continue;
+
+ $profile["pub_keywords"] = profile_clean_keywords($profile["pub_keywords"]);
+
+ $r = q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
+ dbesc($profile["about"]),
+ dbesc($profile["locality"]),
+ dbesc($profile["pub_keywords"]),
+ dbesc($profile["gender"]),
+ intval($profile["uid"])
+ );
+ }
+}
+
+function update_1178() {
+ if (get_config('system','no_community_page'))
+ set_config('system','community_page_style', CP_NO_COMMUNITY_PAGE);
+
+ // Update the central item storage with uid=0
+ proc_run('php',"include/threadupdate.php");
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1180() {
+
+ // Fill the new fields in the term table.
+ proc_run('php',"include/tagupdate.php");
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1188() {
+
+ if (strlen(get_config('system','directory_submit_url')) AND
+ !strlen(get_config('system','directory'))) {
+ set_config('system','directory', dirname(get_config('system','directory_submit_url')));
+ del_config('system','directory_submit_url');
+ }
+
+ return UPDATE_SUCCESS;
+}
+
+function update_1190() {
+
+ require_once('include/plugin.php');
+
+ set_config('system', 'maintenance', 1);
+
+ if (plugin_enabled('forumlist')) {
+ $plugin = 'forumlist';
+ $plugins = get_config('system','addon');
+ $plugins_arr = array();
+
+ if($plugins) {
+ $plugins_arr = explode(",",str_replace(" ", "",$plugins));
+
+ $idx = array_search($plugin, $plugins_arr);
+ if ($idx !== false){
+ unset($plugins_arr[$idx]);
+ //delete forumlist manually from addon and hook table
+ // since uninstall_plugin() don't work here
+ q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
+ q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' ");
+ set_config('system','addon', implode(", ",$plugins_arr));
+ }
+ }
+ }
+
+ // select old formlist addon entries
+ $r = q("SELECT `uid`, `cat`, `k`, `v` FROM `pconfig` WHERE `cat` = '%s' ",
+ dbesc('forumlist')
+ );
+
+ // convert old forumlist addon entries in new config entries
+ if (count($r)) {
+ foreach ($r as $rr) {
+ $uid = $rr['uid'];
+ $family = $rr['cat'];
+ $key = $rr['k'];
+ $value = $rr['v'];
+
+ if ($key === 'randomise')
+ del_pconfig($uid,$family,$key);
+
+ if ($key === 'show_on_profile') {
+ if ($value)
+ set_pconfig($uid,feature,forumlist_profile,$value);
+
+ del_pconfig($uid,$family,$key);
+ }
+
+ if ($key === 'show_on_network') {
+ if ($value)
+ set_pconfig($uid,feature,forumlist_widget,$value);
+
+ del_pconfig($uid,$family,$key);
+ }
+ }
+ }
+
+ set_config('system', 'maintenance', 0);
+
+ return UPDATE_SUCCESS;
+
+}