aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarijus <mario@mariovavti.com>2015-01-24 14:35:21 +0100
committermarijus <mario@mariovavti.com>2015-01-24 14:35:21 +0100
commit63f1ae5e204cdb615a0edb0d16c4c471c2f3264e (patch)
tree90f05fc801749b805291ba3c22d2041272a30257 /include
parented09513bb26f0487e44065c90f3e7d7801d0ac68 (diff)
downloadvolse-hubzilla-63f1ae5e204cdb615a0edb0d16c4c471c2f3264e.tar.gz
volse-hubzilla-63f1ae5e204cdb615a0edb0d16c4c471c2f3264e.tar.bz2
volse-hubzilla-63f1ae5e204cdb615a0edb0d16c4c471c2f3264e.zip
optimize check query
Diffstat (limited to 'include')
-rw-r--r--include/attach.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/attach.php b/include/attach.php
index 850f71f20..c7216df7a 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -981,10 +981,11 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$jsonobject = json_encode($object);
//check if item for this object exists
- $y = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND object = '%s' LIMIT 1",
+ $y = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND resource_id = '%s' AND uid = %d LIMIT 1",
dbesc(ACTIVITY_POST),
dbesc($objtype),
- dbesc($jsonobject)
+ dbesc($object['hash']),
+ intval(local_user())
);
if($y) {
@@ -1026,6 +1027,8 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$arr['verb'] = ACTIVITY_UPDATE;
$arr['obj_type'] = $objtype;
$arr['object'] = $u_jsonobject;
+ $arr['resource_id'] = $object['hash'];
+ $arr['resource_type'] = 'attach';
$arr['body'] = '';
$post = item_store($arr);
@@ -1064,6 +1067,8 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$arr['item_private'] = $private;
$arr['verb'] = (($update) ? ACTIVITY_UPDATE : ACTIVITY_POST);
$arr['obj_type'] = $objtype;
+ $arr['resource_id'] = $object['hash'];
+ $arr['resource_type'] = 'attach';
$arr['object'] = (($update) ? $u_jsonobject : $jsonobject);
$arr['body'] = '';