From: Michael Date: Fri, 24 Nov 2017 07:44:02 +0000 (+0000) Subject: Fix some SQL problems X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4a4be4d6649764ed0317cee59bd632c33ef01f0e;p=friendica.git Fix some SQL problems --- diff --git a/include/items.php b/include/items.php index b251915347..c2247277f1 100644 --- a/include/items.php +++ b/include/items.php @@ -426,7 +426,7 @@ function uri_to_guid($uri, $host = "") { * @return array Item array with removed conversation data */ function store_conversation($arr) { - if (in_array($arr['network'], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) { + if (in_array($arr['network'], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)) && !empty($arr['uri'])) { $conversation = array('item-uri' => $arr['uri'], 'received' => DBM::date()); if (isset($arr['parent-uri']) && ($arr['parent-uri'] != $arr['uri'])) { diff --git a/src/Object/Contact.php b/src/Object/Contact.php index fff82e600d..4f0b237dec 100644 --- a/src/Object/Contact.php +++ b/src/Object/Contact.php @@ -138,7 +138,7 @@ class Contact extends BaseObject */ public static function unmarkForArchival(array $contact) { - $condition = array('`id` => ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE); + $condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE); $exists = dba::exists('contact', $condition); // We don't need to update, we never marked this contact for archival @@ -613,7 +613,7 @@ class Contact extends BaseObject 'readonly' => 0, 'pending' => 0) ); - $s = dba::select('contact', array('id'), array('nurl' => normalise_link($data["url"]), 'uid' => $uid), array('order' => 'id', 'limit' => 2)); + $s = dba::select('contact', array('id'), array('nurl' => normalise_link($data["url"]), 'uid' => $uid), array('order' => array('id'), 'limit' => 2)); $contacts = dba::inArray($s); if (!DBM::is_result($contacts)) { return 0;