From 2f2e7b9d5ab464b9808dd118ca286198d87966df Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 22 Feb 2018 09:51:59 +0000 Subject: [PATCH] fetch_first is now used / additional logging --- src/Model/Item.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index cbc1ac08ff..8747f9fee3 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -280,7 +280,7 @@ class Item extends BaseObject if (!empty($contact_id)) { return $contact_id; } - + logger('Missing contact-id. Called by: '.System::callstack(), LOGGER_DEBUG); /* * First we are looking for a suitable contact that matches with the author of the post * This is done only for comments @@ -483,6 +483,8 @@ class Item extends BaseObject } if ($item['network'] == NETWORK_PHANTOM) { + logger('Missing network. Called by: '.System::callstack(), LOGGER_DEBUG); + $contact = Contact::getDetailsByURL($item['author-link'], $item['uid']); if (!empty($contact['network'])) { $item['network'] = $contact["network"]; @@ -1158,11 +1160,11 @@ class Item extends BaseObject // Does the given user have this item? if ($uid) { - $items = dba::p("SELECT `item`.`id`, `user`.`nickname` FROM `item` + $item = dba::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` AND `item`.`guid` = ? AND `item`.`uid` = ?", $guid, $uid); - if ($item = dba::fetch($items)) { + if (DBM::is_result($item)) { $id = $item["id"]; $nick = $item["nickname"]; } @@ -1170,14 +1172,14 @@ class Item extends BaseObject // Or is it anywhere on the server? if ($nick == "") { - $items = dba::p("SELECT `item`.`id`, `user`.`nickname` FROM `item` + $item = dba::fetch_first("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND NOT `item`.`private` AND `item`.`wall` AND `item`.`guid` = ?", $guid); - if ($item = dba::fetch($items)) { + if (DBM::is_result($item)) { $id = $item["id"]; $nick = $item["nickname"]; } -- 2.39.5