From 5b7d82f3f3cff650927f2d7abfa7ad3b11bcc696 Mon Sep 17 00:00:00 2001 From: Thomas Thune Hansen Date: Thu, 25 Sep 2014 13:39:06 +0200 Subject: [PATCH 1/3] Added external queue for importing meetings --- os2web_esdh_provider.admin.inc | 89 +++++++++++++++++++++++++++++++--- os2web_esdh_provider.module | 53 +++++++++++++++++--- os2web_esdh_provider.queue.php | 29 +++++++++++ 3 files changed, 157 insertions(+), 14 deletions(-) create mode 100644 os2web_esdh_provider.queue.php diff --git a/os2web_esdh_provider.admin.inc b/os2web_esdh_provider.admin.inc index 728b131..115906f 100644 --- a/os2web_esdh_provider.admin.inc +++ b/os2web_esdh_provider.admin.inc @@ -38,19 +38,78 @@ function _os2web_esdh_provider_status() { $watchdog_head = array(t('Warning messages in descending order'), t('Date')); foreach ($watchdog_messages as $row) { $watchdog_rows[] = array( - t($row->message, unserialize($row->variables)), + format_string($row->message, unserialize($row->variables)), format_date($row->timestamp), ); } $watchdog_table = theme('table', array('header' => $watchdog_head, 'rows' => $watchdog_rows)); } + if (variable_get('os2web_esdh_provider_queue_enabled', FALSE)) { + // Status for external meeting importer. + $queue_markup = '

Meeting import: currently not running

'; + + if (!lock_acquire('os2web_esdh_provider_queue')) { + $queue_markup = '

Meeting import: running!

'; + } + + $queue_full = variable_get('os2web_esdh_provider_queue'); + + $queue_markup .= drupal_render(drupal_get_form('os2web_esdh_provider_queue_form')); + $queue_markup .= '

In queue

'; + + $queue_header = array(t('Publication id:'), t('uri'), t('Force')); + $queue_rows = array(); + + foreach ($queue_full as $key => $queue) { + if (isset($queue['operations'])) { + + foreach ($queue['operations'] as $operation) { + $id = $operation[1][0]['id']; + $uri = $operation[1][0]['uri']; + $operation[1][1] ? $force = 'True' : $force = ''; + + if (is_numeric($id)) { + $queue_rows[] = array($id, $uri, $force); + } + } + } + } + $queue_status .= '
' . $queue_markup . theme('table', array( + 'header' => $queue_header, + 'rows' => $queue_rows, + 'empty' => t('Queue is empty'), + )); + } + $import_form = drupal_get_form('os2web_esdh_provider_import_form'); return '

' . t('ESDH Provider API plugin status') . '

' . theme('table', array('header' => $head, 'rows' => $rows)) . - '

' . t('Import of MM Based ESDH documents. (Last import was run at %time)', array('%time' => format_date(variable_get('os2web_esdh_provider_last_import', 0)))) . '

' . - drupal_render($import_form) . - $watchdog_table; + '

' . t('Last agenda import was successfully run at %time', array('%time' => format_date(variable_get('os2web_esdh_provider_last_import', 0)))) . '

' . + '

' . t('Last import job was run at %time', array('%time' => format_date(variable_get('os2web_esdh_provider_last_mm_import', 0)))) . '

' . + drupal_render($import_form) . $watchdog_table . $queue_status; +} + +/** + * Queue form. + */ +function os2web_esdh_provider_queue_form($form_state) { + $form = array(); + $form['delete'] = array( + '#type' => 'submit', + '#value' => t('Delete queue'), + ); + + return $form; +} + +/** + * Submit handler for queue from. + */ +function os2web_esdh_provider_queue_form_submit(&$form, &$form_state) { + // Empty queue. + variable_set('os2web_esdh_provider_queue', array()); + drupal_set_message(t('Deleted queue')); } /** @@ -106,7 +165,6 @@ function os2web_esdh_provider_import_form_submit($form, &$form_state) { 'force' => $form_state['values']['force'], ), )); - return; } /** @@ -148,6 +206,9 @@ function _os2web_esdh_provider_status_confirm_submit($form, &$form_state) { drupal_set_message(t('ERROR: No valid MM importer plugin active!'), 'error'); return; } + + $external_queue = variable_get('os2web_esdh_provider_queue_enabled', FALSE); + $force = $form_state['values']['_meeting_force'] == 1; $focus = array_map('trim', explode(',', $form_state['values']['_meeting_id'])); if (count($focus) === 1 && $focus[0] === '') { @@ -173,7 +234,19 @@ function _os2web_esdh_provider_status_confirm_submit($form, &$form_state) { 'os2web_esdh_provider_invoke', array('mm', 'post_import_process')); } - batch_set($batch); - // This isn't entirely neccesary, but needed to make the redirect work. - batch_process('admin/config/os2web/esdh_provider'); + + variable_set('os2web_esdh_provider_last_mm_import', $current_timestamp); + + if ($external_queue) { + $queue_full = variable_get('os2web_esdh_provider_queue', array()); + $queue_full[time()] = $batch; + + variable_set('os2web_esdh_provider_queue', $queue_full); + drupal_goto('admin/config/os2web/esdh_provider'); + } + else { + batch_set($batch); + // This isn't entirely neccesary, but needed to make the redirect work. + batch_process('admin/config/os2web/esdh_provider'); + } } diff --git a/os2web_esdh_provider.module b/os2web_esdh_provider.module index f03fa30..7144921 100644 --- a/os2web_esdh_provider.module +++ b/os2web_esdh_provider.module @@ -1,5 +1,4 @@ TRUE, 'file' => 'os2web_esdh_provider.cpapi.inc', ); + return $items; } @@ -56,13 +56,29 @@ function os2web_esdh_provider_menu() { * Implements hook_FORM_alter(). */ function os2web_esdh_provider_form_os2web_settings_settings_form_alter(&$form, &$form_state) { + + $form['os2web_esdh_provider'] = array( + '#type' => 'fieldset', + '#title' => 'Import', + '#description' => 'Generelle indstillinger vedr. import', + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + // MM configuration. - $form['meetings']['os2web_meetings_import_service_ip'] = array( + $form['os2web_esdh_provider']['os2web_meetings_import_service_ip'] = array( '#type' => 'textfield', '#title' => 'IP addresser der kan udløse import', '#description' => 'Komma separeret liste af ip-addresser der kan tilgå admin/os2web/import/.', '#default_value' => variable_get('os2web_meetings_import_service_ip', ip_address()), ); + + // Enable external queue import. + $form['os2web_esdh_provider']['os2web_esdh_provider_queue_enabled'] = array( + '#type' => 'checkbox', + '#title' => t('Enable external queue import'), + '#default_value' => variable_get('os2web_esdh_provider_queue_enabled', FALSE), + ); } /** @@ -144,7 +160,7 @@ function os2web_esdh_provider_node_delete($node) { node_delete($add_node->nid); } } - //Delete bullets from meeting. + // Delete bullets from meeting. $items = array_shift($node->field_os2web_meetings_bullets); if (is_array($items)) { foreach ($items as $nids) { @@ -170,20 +186,46 @@ function os2web_esdh_provider_node_delete($node) { */ function os2web_esdh_provider_cron() { if (os2web_esdh_provider_has_api('mm')) { + // Added posibility to run import externally via + // "drush scr os2web_esdh_provider.queue.php" + $external_queue = variable_get('os2web_esdh_provider_queue_enabled', FALSE); + $meetings = os2web_esdh_provider_invoke('mm', 'get_import_list'); $queue = DrupalQueue::get('acadre_mm_import'); + if ($queue->numberOfItems() == 0) { $current_timestamp = time(); $last_mm_import_time = variable_get('os2web_esdh_provider_last_mm_import', FALSE); + $batch = array(); foreach ($meetings as $meeting) { // Only import files newer than last cron job. if (!$last_mm_import_time || filemtime($meeting['uri']) > $last_mm_import_time) { - $queue->createItem(array('meeting' => $meeting, 'force' => FALSE)); + + if ($external_queue) { + $batch['operations'][] = array( + '_os2web_esdh_provider_import_meeting', + array($meeting, FALSE)); + } + else { + $queue->createItem(array('meeting' => $meeting, 'force' => FALSE)); + } + } + } + + if ($external_queue) { + if (!empty($batch)) { + $queue_full = variable_get('os2web_esdh_provider_queue', array()); + $queue_full[time()] = $batch; + + variable_set('os2web_esdh_provider_queue', $queue_full); } } - $queue->createItem(array('post_import_process' => TRUE)); + else { + $queue->createItem(array('post_import_process' => TRUE)); + } + variable_set('os2web_esdh_provider_last_mm_import', $current_timestamp); } } @@ -541,7 +583,6 @@ function o2web_esdh_provider_help($path, $arg) { * Implements hook_os2web_help(). */ function o2web_esdh_provider_os2web_help($sections) { - // Module specific. $sections['list_of_content'] .= t('OS2web ESDH Provider
'); $sections['o2web_esdh_provider'] = t('

The ESDH Provider:

'); diff --git a/os2web_esdh_provider.queue.php b/os2web_esdh_provider.queue.php new file mode 100644 index 0000000..aa03ab3 --- /dev/null +++ b/os2web_esdh_provider.queue.php @@ -0,0 +1,29 @@ + $queue) { + foreach ($queue['operations'] as $operation) { + $operation[0]($operation[1][0], $operation[1][1]); + } + unset($queue_full[$key]); + + variable_set('os2web_esdh_provider_queue', $queue_full); + } + } +} + +lock_release('os2web_esdh_provider_queue'); From 837132998191473b77346e9faae5cecadc8afc05 Mon Sep 17 00:00:00 2001 From: Thomas Thune Hansen Date: Thu, 25 Sep 2014 14:23:39 +0200 Subject: [PATCH 2/3] Improvements to status page, queueing meetings. * Updated README.md * Sensible ordering of items on status page * Moved queueing of meeting imports to os2web_esdh_provider.queue.php --- README.md | 5 +++ os2web_esdh_provider.admin.inc | 8 +++-- os2web_esdh_provider.module | 64 +++++++++++++++++++--------------- os2web_esdh_provider.queue.php | 2 ++ 4 files changed, 49 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 3d9fc4d..8258059 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,11 @@ See https://github.com/syddjurs/os2web/wiki for further instructions. This module can also be installed with drush make in your install profile. +### External queue +If external queue is selected from settings, `os2web_esdh_provider.queue.php`, must be +executed using the servers crontab. This can be done using `drush php-script`, see + + Licence and copyright --------------------- OS2Web is Copyright (c) 2012 Syddjurs Kommune, Denmark diff --git a/os2web_esdh_provider.admin.inc b/os2web_esdh_provider.admin.inc index 115906f..da69b4a 100644 --- a/os2web_esdh_provider.admin.inc +++ b/os2web_esdh_provider.admin.inc @@ -45,6 +45,8 @@ function _os2web_esdh_provider_status() { $watchdog_table = theme('table', array('header' => $watchdog_head, 'rows' => $watchdog_rows)); } + $queue_status = ''; + if (variable_get('os2web_esdh_provider_queue_enabled', FALSE)) { // Status for external meeting importer. $queue_markup = '

Meeting import: currently not running

'; @@ -75,11 +77,13 @@ function _os2web_esdh_provider_status() { } } } - $queue_status .= '
' . $queue_markup . theme('table', array( + $queue_status .= '


' . $queue_markup . theme('table', array( 'header' => $queue_header, 'rows' => $queue_rows, 'empty' => t('Queue is empty'), )); + + $queue_status .= '


'; } $import_form = drupal_get_form('os2web_esdh_provider_import_form'); @@ -87,7 +91,7 @@ function _os2web_esdh_provider_status() { theme('table', array('header' => $head, 'rows' => $rows)) . '

' . t('Last agenda import was successfully run at %time', array('%time' => format_date(variable_get('os2web_esdh_provider_last_import', 0)))) . '

' . '

' . t('Last import job was run at %time', array('%time' => format_date(variable_get('os2web_esdh_provider_last_mm_import', 0)))) . '

' . - drupal_render($import_form) . $watchdog_table . $queue_status; + drupal_render($import_form) . $queue_status . $watchdog_table; } /** diff --git a/os2web_esdh_provider.module b/os2web_esdh_provider.module index 7144921..cbb3189 100644 --- a/os2web_esdh_provider.module +++ b/os2web_esdh_provider.module @@ -56,7 +56,6 @@ function os2web_esdh_provider_menu() { * Implements hook_FORM_alter(). */ function os2web_esdh_provider_form_os2web_settings_settings_form_alter(&$form, &$form_state) { - $form['os2web_esdh_provider'] = array( '#type' => 'fieldset', '#title' => 'Import', @@ -185,50 +184,59 @@ function os2web_esdh_provider_node_delete($node) { * Will run import on every cron. */ function os2web_esdh_provider_cron() { - if (os2web_esdh_provider_has_api('mm')) { - // Added posibility to run import externally via - // "drush scr os2web_esdh_provider.queue.php" - $external_queue = variable_get('os2web_esdh_provider_queue_enabled', FALSE); + // Added posibility to run import externally via + // "drush scr os2web_esdh_provider.queue.php" + if (variable_get('os2web_esdh_provider_queue_enabled', FALSE)) { + return; + } + if (os2web_esdh_provider_has_api('mm')) { $meetings = os2web_esdh_provider_invoke('mm', 'get_import_list'); - $queue = DrupalQueue::get('acadre_mm_import'); + $queue = DrupalQueue::get('acadre_mm_import'); if ($queue->numberOfItems() == 0) { $current_timestamp = time(); $last_mm_import_time = variable_get('os2web_esdh_provider_last_mm_import', FALSE); - $batch = array(); foreach ($meetings as $meeting) { // Only import files newer than last cron job. if (!$last_mm_import_time || filemtime($meeting['uri']) > $last_mm_import_time) { - - if ($external_queue) { - $batch['operations'][] = array( - '_os2web_esdh_provider_import_meeting', - array($meeting, FALSE)); - } - else { - $queue->createItem(array('meeting' => $meeting, 'force' => FALSE)); - } + $queue->createItem(array('meeting' => $meeting, 'force' => FALSE)); } } + $queue->createItem(array('post_import_process' => TRUE)); + variable_set('os2web_esdh_provider_last_mm_import', $current_timestamp); + } + } +} - if ($external_queue) { - if (!empty($batch)) { - $queue_full = variable_get('os2web_esdh_provider_queue', array()); - $queue_full[time()] = $batch; +/** + * Worker function that queues meetings for external import. + */ +function os2web_esdh_provider_queue_meetings() { + $meetings = os2web_esdh_provider_invoke('mm', 'get_import_list'); + + $batch = array(); + $last_mm_import_time = variable_get('os2web_esdh_provider_last_mm_import', FALSE); + + foreach ($meetings as $meeting) { + // Only import files newer than last cron job. + if (!$last_mm_import_time || filemtime($meeting['uri']) > $last_mm_import_time) { + $batch['operations'][] = array( + '_os2web_esdh_provider_import_meeting', + array($meeting, FALSE)); + } + } - variable_set('os2web_esdh_provider_queue', $queue_full); - } - } - else { - $queue->createItem(array('post_import_process' => TRUE)); - } + if (!empty($batch)) { + $queue_full = variable_get('os2web_esdh_provider_queue', array()); + $queue_full[time()] = $batch; - variable_set('os2web_esdh_provider_last_mm_import', $current_timestamp); - } + variable_set('os2web_esdh_provider_queue', $queue_full); } + + variable_set('os2web_esdh_provider_last_mm_import', time()); } /** diff --git a/os2web_esdh_provider.queue.php b/os2web_esdh_provider.queue.php index aa03ab3..4f7ede8 100644 --- a/os2web_esdh_provider.queue.php +++ b/os2web_esdh_provider.queue.php @@ -11,6 +11,8 @@ require_once 'os2web_esdh_provider.mmapi.inc'; +os2web_esdh_provider_queue_meetings(); + if (lock_acquire('os2web_esdh_provider_queue', 10000)) { $queue_full = variable_get('os2web_esdh_provider_queue'); From 0dce948b580dc2dba55d4fb9f44be50ad2577ac6 Mon Sep 17 00:00:00 2001 From: Thomas Thune Hansen Date: Thu, 25 Sep 2014 15:04:56 +0200 Subject: [PATCH 3/3] Use drupals queueing system --- os2web_esdh_provider.admin.inc | 72 ++++++++++++++++++---------------- os2web_esdh_provider.module | 40 +++++++++---------- os2web_esdh_provider.queue.php | 14 ++----- 3 files changed, 62 insertions(+), 64 deletions(-) diff --git a/os2web_esdh_provider.admin.inc b/os2web_esdh_provider.admin.inc index da69b4a..ded39a0 100644 --- a/os2web_esdh_provider.admin.inc +++ b/os2web_esdh_provider.admin.inc @@ -55,28 +55,23 @@ function _os2web_esdh_provider_status() { $queue_markup = '

Meeting import: running!

'; } - $queue_full = variable_get('os2web_esdh_provider_queue'); - $queue_markup .= drupal_render(drupal_get_form('os2web_esdh_provider_queue_form')); $queue_markup .= '

In queue

'; $queue_header = array(t('Publication id:'), t('uri'), t('Force')); $queue_rows = array(); - foreach ($queue_full as $key => $queue) { - if (isset($queue['operations'])) { - - foreach ($queue['operations'] as $operation) { - $id = $operation[1][0]['id']; - $uri = $operation[1][0]['uri']; - $operation[1][1] ? $force = 'True' : $force = ''; - - if (is_numeric($id)) { - $queue_rows[] = array($id, $uri, $force); - } - } + $queue = DrupalQueue::get('acadre_mm_import'); + while($item = $queue->claimItem()) { + if (isset($item->data['meeting'])) { + $queue_rows[] = array( + $item->data['meeting']['id'], + $item->data['meeting']['uri'], + $item->data['force'], + ); } } + $queue_status .= '


' . $queue_markup . theme('table', array( 'header' => $queue_header, 'rows' => $queue_rows, @@ -112,7 +107,11 @@ function os2web_esdh_provider_queue_form($form_state) { */ function os2web_esdh_provider_queue_form_submit(&$form, &$form_state) { // Empty queue. - variable_set('os2web_esdh_provider_queue', array()); + $queue = DrupalQueue::get('acadre_mm_import'); + while($item = $queue->claimItem()) { + $queue->deleteItem($item); + } + drupal_set_message(t('Deleted queue')); } @@ -211,8 +210,6 @@ function _os2web_esdh_provider_status_confirm_submit($form, &$form_state) { return; } - $external_queue = variable_get('os2web_esdh_provider_queue_enabled', FALSE); - $force = $form_state['values']['_meeting_force'] == 1; $focus = array_map('trim', explode(',', $form_state['values']['_meeting_id'])); if (count($focus) === 1 && $focus[0] === '') { @@ -225,32 +222,39 @@ function _os2web_esdh_provider_status_confirm_submit($form, &$form_state) { 'file' => drupal_get_path('module', 'os2web_esdh_provider') . '/os2web_esdh_provider.mmapi.inc', 'init_message' => t('Scanner filer'), ); + $meetings = os2web_esdh_provider_invoke('mm', 'get_import_list'); - foreach ($meetings as $meeting) { - if (empty($focus) || in_array($meeting['id'], $focus)) { - $batch['operations'][] = array( - '_os2web_esdh_provider_import_meeting', - array($meeting, $force)); - } - } - if (os2web_esdh_provider_supports('mm', 'post_import_process')) { - $batch['operations'][] = array( - 'os2web_esdh_provider_invoke', - array('mm', 'post_import_process')); - } - variable_set('os2web_esdh_provider_last_mm_import', $current_timestamp); + if (variable_get('os2web_esdh_provider_queue_enabled', FALSE)) { + $queue = DrupalQueue::get('acadre_mm_import'); - if ($external_queue) { - $queue_full = variable_get('os2web_esdh_provider_queue', array()); - $queue_full[time()] = $batch; + foreach ($meetings as $meeting) { + if (empty($focus) || in_array($meeting['id'], $focus)) { + $queue->createItem(array('meeting' => $meeting, 'force' => $force)); + } + } + $queue->createItem(array('post_import_process' => TRUE)); - variable_set('os2web_esdh_provider_queue', $queue_full); drupal_goto('admin/config/os2web/esdh_provider'); } + // Use normal batch processing if external queue is disabled. else { + foreach ($meetings as $meeting) { + if (empty($focus) || in_array($meeting['id'], $focus)) { + $batch['operations'][] = array( + '_os2web_esdh_provider_import_meeting', + array($meeting, $force)); + } + } + if (os2web_esdh_provider_supports('mm', 'post_import_process')) { + $batch['operations'][] = array( + 'os2web_esdh_provider_invoke', + array('mm', 'post_import_process')); + } + batch_set($batch); // This isn't entirely neccesary, but needed to make the redirect work. + variable_set('os2web_esdh_provider_last_mm_import', $current_timestamp); batch_process('admin/config/os2web/esdh_provider'); } } diff --git a/os2web_esdh_provider.module b/os2web_esdh_provider.module index cbb3189..a1797d5 100644 --- a/os2web_esdh_provider.module +++ b/os2web_esdh_provider.module @@ -184,8 +184,6 @@ function os2web_esdh_provider_node_delete($node) { * Will run import on every cron. */ function os2web_esdh_provider_cron() { - // Added posibility to run import externally via - // "drush scr os2web_esdh_provider.queue.php" if (variable_get('os2web_esdh_provider_queue_enabled', FALSE)) { return; } @@ -193,7 +191,7 @@ function os2web_esdh_provider_cron() { if (os2web_esdh_provider_has_api('mm')) { $meetings = os2web_esdh_provider_invoke('mm', 'get_import_list'); - $queue = DrupalQueue::get('acadre_mm_import'); + $queue = DrupalQueue::get('acadre_mm_import'); if ($queue->numberOfItems() == 0) { $current_timestamp = time(); @@ -215,34 +213,36 @@ function os2web_esdh_provider_cron() { * Worker function that queues meetings for external import. */ function os2web_esdh_provider_queue_meetings() { - $meetings = os2web_esdh_provider_invoke('mm', 'get_import_list'); + if (os2web_esdh_provider_has_api('mm')) { + $meetings = os2web_esdh_provider_invoke('mm', 'get_import_list'); - $batch = array(); - $last_mm_import_time = variable_get('os2web_esdh_provider_last_mm_import', FALSE); + $last_mm_import_time = variable_get('os2web_esdh_provider_last_mm_import', FALSE); - foreach ($meetings as $meeting) { - // Only import files newer than last cron job. - if (!$last_mm_import_time || filemtime($meeting['uri']) > $last_mm_import_time) { - $batch['operations'][] = array( - '_os2web_esdh_provider_import_meeting', - array($meeting, FALSE)); - } - } + $queue = DrupalQueue::get('acadre_mm_import'); - if (!empty($batch)) { - $queue_full = variable_get('os2web_esdh_provider_queue', array()); - $queue_full[time()] = $batch; + foreach ($meetings as $meeting) { + // Only import files newer than last cron job. + if (!$last_mm_import_time || filemtime($meeting['uri']) > $last_mm_import_time) { + $queue->createItem(array('meeting' => $meeting, 'force' => FALSE)); + } + } + $queue->createItem(array('post_import_process' => TRUE)); + variable_set('os2web_esdh_provider_last_mm_import', $current_timestamp); - variable_set('os2web_esdh_provider_queue', $queue_full); + variable_set('os2web_esdh_provider_last_mm_import', time()); } - - variable_set('os2web_esdh_provider_last_mm_import', time()); } /** * Implements hook_cron_queue_info(). */ function os2web_esdh_provider_cron_queue_info() { + // If the external queue handler is enabled, don't let + // drupals cron impor the meetings. + if (variable_get('os2web_esdh_provider_queue_enabled', FALSE)) { + return array(); + } + $queues['acadre_mm_import'] = array( 'worker callback' => '_os2web_esdh_provider_cron_queue_worker', 'time' => 30, diff --git a/os2web_esdh_provider.queue.php b/os2web_esdh_provider.queue.php index 4f7ede8..61d78c2 100644 --- a/os2web_esdh_provider.queue.php +++ b/os2web_esdh_provider.queue.php @@ -14,17 +14,11 @@ os2web_esdh_provider_queue_meetings(); if (lock_acquire('os2web_esdh_provider_queue', 10000)) { - $queue_full = variable_get('os2web_esdh_provider_queue'); + $queue = DrupalQueue::get('acadre_mm_import'); - if (!empty($queue_full)) { - foreach ($queue_full as $key => $queue) { - foreach ($queue['operations'] as $operation) { - $operation[0]($operation[1][0], $operation[1][1]); - } - unset($queue_full[$key]); - - variable_set('os2web_esdh_provider_queue', $queue_full); - } + while($item = $queue->claimItem()) { + _os2web_esdh_provider_cron_queue_worker($item->data); + $queue->deleteItem($item); } }