From c2213760412f6d178d77451d69ae467534042457 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 4 Jan 2017 23:12:28 +0000 Subject: [PATCH] Some notification thingy --- include/dbstructure.php | 7 +++++-- include/enotify.php | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/dbstructure.php b/include/dbstructure.php index 706b3650d8..646fc408cf 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -538,7 +538,7 @@ function db_definition($charset) { "site-pubkey" => array("type" => "text"), "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), - "url" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "collation" => "bin"), + "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), @@ -1074,7 +1074,10 @@ function db_definition($charset) { ), "indexes" => array( "PRIMARY" => array("id"), - "uid" => array("uid"), + "uid_hash" => array("uid", "hash"), + "uid_seen" => array("uid", "seen"), + "uid_type_link" => array("uid", "type", "link"), + "uid_link" => array("uid", "link"), ) ); $database["notify-threads"] = array( diff --git a/include/enotify.php b/include/enotify.php index aa29e117a6..ebc27309db 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -105,7 +105,7 @@ function notification($params) { // If so don't create a second notification $p = null; - $p = q("SELECT `id` FROM `notify` WHERE (`type` = %d OR `type` = %d OR `type` = %d) AND `link` = '%s' AND `uid` = %d LIMIT 1", + $p = q("SELECT `id` FROM `notify` WHERE `type` IN (%d, %d, %d) AND `link` = '%s' AND `uid` = %d LIMIT 1", intval(NOTIFY_TAGSELF), intval(NOTIFY_COMMENT), intval(NOTIFY_SHARE), @@ -472,7 +472,7 @@ function notification($params) { // After we've stored everything, look again to see if there are any duplicates and if so remove them $p = null; - $p = q("SELECT `id` FROM `notify` WHERE (`type` = %d OR `type` = %d) AND `link` = '%s' AND `uid` = %d ORDER BY `id`", + $p = q("SELECT `id` FROM `notify` WHERE `type` IN (%d, %d) AND `link` = '%s' AND `uid` = %d ORDER BY `id`", intval(NOTIFY_TAGSELF), intval(NOTIFY_COMMENT), dbesc($params['link']),