Commit daca398e authored by swentel's avatar swentel

Remove queue item

parent c7789200
......@@ -113,7 +113,10 @@ An overview can be found at user/x/activitypub.
Activities in the outbox are stored in a queue and send either by
cron or drush. Configure this at /admin/config/services/activitypub
The drush command is activitypub:send-activities
The drush command is activitypub:send-activities which has 3 parameters
- send: send activity request (defaults to 1)
- debug: show command line debug messages (defaults to 0)
- delete: remove queue item (defaults to 1)
## Drush commands
......
......@@ -18,11 +18,13 @@ class ActivityPubCommands extends DrushCommands {
* Whether to send to activities to inboxes.
* @param int $debug
* Whether to view debug statements.
* @param int $remove_queue_item
* Delete from queue item.
*
* @command activitypub:send-activities
* @aliases asa,activitypub-send-activities
*/
public function sendActivities($send = 1, $debug = 0) {
public function sendActivities($send = 1, $debug = 0, $remove_queue_item = 1) {
if (\Drupal::config('activitypub.settings')->get('send_outbox_handler') == 'drush') {
// Make sure the host is not set to default.
......@@ -31,7 +33,7 @@ class ActivityPubCommands extends DrushCommands {
return;
}
\Drupal::service('activitypub.outbox.client')->handleOutboxQueue((bool) $send, (bool) $debug);
\Drupal::service('activitypub.outbox.client')->handleOutboxQueue((bool) $send, (bool) $debug, (bool) $remove_queue_item);
}
}
......
......@@ -77,7 +77,7 @@ class ActivityPubOutboxClient implements ActivityPubOutboxClientInterface {
/**
* {@inheritdoc}
*/
public function handleOutboxQueue($send = TRUE, $debug = FALSE) {
public function handleOutboxQueue($send = TRUE, $remove_queue_item = TRUE, $debug = FALSE) {
$end = time() + 15;
$release_items = [];
$this->setDebug($debug);
......@@ -162,7 +162,7 @@ class ActivityPubOutboxClient implements ActivityPubOutboxClientInterface {
}
}
if ($this->debug) {
if (!$remove_queue_item) {
$remove_queue_item = FALSE;
}
}
......
......@@ -14,11 +14,12 @@ interface ActivityPubOutboxClientInterface {
*
* @param bool $send
* Whether to send to inboxes.
* @param bool $remove_queue_item
* Whether to remove the queue item.
* @param bool $debug
* Whether to view debug statements, useful when using Drush. In this case
* the queue items will not be removed either.
* Whether to view debug statements, useful when using Drush.
*/
public function handleOutboxQueue($send = TRUE, $debug = FALSE);
public function handleOutboxQueue($send = TRUE, $remove_queue_item = TRUE, $debug = FALSE);
/**
* Generates a queue item.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment