[CORE][QUEUE] Error checking and type declaration on handling notice queue events
Patch submitted by XRevan86
This commit is contained in:
committed by
Diogo Cordeiro
parent
de91d28f6f
commit
aaabf82eff
@@ -17,9 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Prepare WebSub and Salmon distributions for an outgoing message.
|
||||
@@ -46,9 +44,12 @@ class OStatusQueueHandler extends QueueHandler
|
||||
return 'ostatus';
|
||||
}
|
||||
|
||||
function handle($notice)
|
||||
function handle($notice): bool
|
||||
{
|
||||
assert($notice instanceof Notice);
|
||||
if (!($notice instanceof Notice)) {
|
||||
common_log(LOG_ERR, "Got a bogus notice, not distributing");
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->notice = $notice;
|
||||
$this->user = User::getKV('id', $notice->profile_id);
|
||||
|
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
defined('GNUSOCIAL') || die();
|
||||
|
||||
/**
|
||||
* Process a feed distribution POST from a WebSub (previously PuSH) hub.
|
||||
@@ -31,9 +31,12 @@ class PushInQueueHandler extends QueueHandler
|
||||
return 'pushin';
|
||||
}
|
||||
|
||||
function handle($data)
|
||||
function handle($data): bool
|
||||
{
|
||||
assert(is_array($data));
|
||||
if (!is_array($data)) {
|
||||
common_log(LOG_ERR, "Got bogus data, not processing");
|
||||
return true;
|
||||
}
|
||||
|
||||
$feedsub_id = $data['feedsub_id'];
|
||||
$post = $data['post'];
|
||||
|
Reference in New Issue
Block a user