function media_acquiadam_refresh_asset_sync_notifications_queue in Media: Acquia DAM 8
Adds media items to the asset sync queue for later processing.
Uses the Notifications API to get affected asset ids. Determines which assets where changed within the given period of time, and adds them to the queue.
1 call to media_acquiadam_refresh_asset_sync_notifications_queue()
- media_acquiadam_cron in ./
media_acquiadam.module - Implements hook_cron().
File
- ./
media_acquiadam.module, line 205 - Integrates Drupal with Acquia DAM.
Code
function media_acquiadam_refresh_asset_sync_notifications_queue() {
$asset_id_fields = media_acquiadam_get_bundle_asset_id_fields();
if (empty($asset_id_fields)) {
return;
}
$queue = Drupal::queue('media_acquiadam_asset_refresh');
// We only want to re-queue everything when the queue is totally empty. This
// should help minimize the number of duplicate syncs we perform on assets.
if ($queue
->numberOfItems() > 0) {
return;
}
/** @var \Drupal\media_acquiadam\Service\AssetRefreshManagerInterface $asset_refresh_manager */
$asset_refresh_manager = \Drupal::service('media_acquiadam.asset_refresh.manager');
$asset_refresh_manager
->updateQueue($asset_id_fields);
}