<?php
-define( 'UPDATE_VERSION' , 1169 );
+define( 'UPDATE_VERSION' , 1170 );
/**
*
$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'])
$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'])
);
if(count($r)) {
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']));
}
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'])
);
$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'])),
$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'])
);
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'])
);
$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'])
);
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'])
);
}
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'])
);
}
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;
+}