. * */ namespace Friendica\Worker; use Friendica\Core\Logger; use Friendica\Core\Worker; use Friendica\Database\DBA; /** * Requeue posts that are stuck in the post-delivery table without a matching delivery job. * This should not happen in regular situations, this is a precaution. */ class RequeuePosts { public static function execute() { $deliveries = DBA::p("SELECT `item-uri`.`uri` AS `inbox` FROM `post-delivery` INNER JOIN `item-uri` ON `item-uri`.`id` = `post-delivery`.`inbox-id` GROUP BY `inbox`"); while ($delivery = DBA::fetch($deliveries)) { if (Worker::add(PRIORITY_HIGH, 'APDelivery', '', 0, $delivery['inbox'], 0)) { Logger::info('Missing APDelivery worker added for inbox', ['inbox' => $delivery['inbox']]); } } DBA::close($deliveries); } }