[CORE][QUEUE] Error checking and type declaration on handling notice queue events

Patch submitted by XRevan86
This commit is contained in:
Miguel Dantas
2019-08-07 22:47:17 +01:00
committed by Diogo Cordeiro
parent de91d28f6f
commit aaabf82eff
10 changed files with 66 additions and 27 deletions

View File

@@ -17,20 +17,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
defined('GNUSOCIAL') || die();
/**
* Queue handler for pushing new notices to ping servers.
*/
class PingQueueHandler extends QueueHandler {
function transport() {
function transport()
{
return 'ping';
}
function handle($notice) {
function handle($notice): bool
{
if (!($notice instanceof Notice)) {
common_log(LOG_ERR, "Got a bogus notice, not broadcasting");
return true;
}
require_once INSTALLDIR . '/lib/ping.php';
return ping_broadcast_notice($notice);
}