<?php
function add_thread($itemid, $onlyshadow = false) {
- $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
- `deleted`, `origin`, `forum_mode`, `mention`, `network` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
+ $items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,
+ `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
+ `deleted`, `origin`, `forum_mode`, `mention`, `network`, `author-id`, `owner-id`
+ FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
if (!$items)
return;
$sql .= "`".$field."` = '".dbesc($data)."'";
}
+ logger("Pre Update Thread", LOGGER_DEBUG);
$result = q("UPDATE `thread` SET ".$sql." WHERE `iid` = %d", intval($itemid));
+ logger("Post Update Thread", LOGGER_DEBUG);
logger("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".print_r($result, true)." ".print_r($item, true), LOGGER_DEBUG);
if (!$items)
return;
+ logger("Pre Update Item", LOGGER_DEBUG);
$result = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d",
dbesc($item["title"]),
dbesc($item["body"]),
dbesc($item["rendered-hash"]),
intval($items[0]["id"])
);
+ logger("Post Update Item", LOGGER_DEBUG);
logger("Updating public shadow for post ".$items[0]["id"]." - guid ".$item["guid"]." Result: ".print_r($result, true), LOGGER_DEBUG);
}
intval($item["uid"])
);
if (!count($r)) {
- $r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0)",
+ $r = q("DELETE FROM `item` WHERE `uri` = '%s' AND `uid` = 0",
dbesc($itemuri)
);
logger("delete_thread: Deleted shadow for item ".$itemuri." - ".print_r($result, true), LOGGER_DEBUG);