X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fhandlequeued.php;h=0d77030c3f40b8542b330727538cc411532051da;hb=586aaa596e2277a2c4bea9cae476014a2837a41d;hp=9031437aac9439a1139ff3deaa30857c468ff5ae;hpb=543026b8d1411c7d71a6482d0649ab3523f489b8;p=quix0rs-gnu-social.git diff --git a/scripts/handlequeued.php b/scripts/handlequeued.php index 9031437aac..0d77030c3f 100755 --- a/scripts/handlequeued.php +++ b/scripts/handlequeued.php @@ -38,19 +38,21 @@ $queue = trim($args[0]); $noticeId = intval($args[1]); $qm = QueueManager::get(); -$handler = $qm->getHandler($queue); -if (!$handler) { +try { + $handler = $qm->getHandler($queue); + $notice = Notice::getByID($noticeId); + $result = $handler->handle($notice); +} catch (NoQueueHandlerException $e) { print "No handler for queue '$queue'.\n"; exit(1); -} - -$notice = Notice::staticGet('id', $noticeId); -if (empty($notice)) { - print "Invalid notice id $noticeId\n"; +} catch (NoResultException $e) { + print "{$e->getMessage()}\n"; + exit(1); +} catch (Exception $e) { + print "Exception thrown while handling: {$e->getMessage()}\n"; exit(1); } - -if (!$handler->handle_notice($notice)) { +if (!$result) { print "Failed to handle notice id $noticeId on queue '$queue'.\n"; exit(1); }