Merge pull request #3693 from annando/remote-self-finally

"remote self" now finally really works with addons
This commit is contained in:
Tobias Diekershoff 2017-09-08 11:00:06 +02:00 committed by GitHub
commit d79fe20f61
2 changed files with 10 additions and 3 deletions

View file

@ -1595,9 +1595,6 @@ function item_is_remote_self($contact, &$datarray) {
$datarray['author-link'] = $datarray['owner-link']; $datarray['author-link'] = $datarray['owner-link'];
$datarray['author-avatar'] = $datarray['owner-avatar']; $datarray['author-avatar'] = $datarray['owner-avatar'];
// Trigger automatic reactions for addons
$datarray['api_source'] = true;
unset($datarray['created']); unset($datarray['created']);
unset($datarray['edited']); unset($datarray['edited']);
} }
@ -1623,6 +1620,13 @@ function item_is_remote_self($contact, &$datarray) {
$datarray["app"] = "Feed"; $datarray["app"] = "Feed";
} }
// Trigger automatic reactions for addons
$datarray['api_source'] = true;
// We have to tell the hooks who we are - this really should be improved
$_SESSION["authenticated"] = true;
$_SESSION["uid"] = $contact['uid'];
return true; return true;
} }

View file

@ -303,6 +303,9 @@ function poller_exec_function($queue, $funcname, $argv) {
$up_duration = number_format(microtime(true) - $poller_up_start, 3); $up_duration = number_format(microtime(true) - $poller_up_start, 3);
// Reset global data to avoid interferences
unset($_SESSION);
$funcname($argv, $argc); $funcname($argv, $argc);
$a->process_id = $old_process_id; $a->process_id = $old_process_id;