function bynder_cron in Bynder 8
Same name and namespace in other branches
- 8.3 bynder.module \bynder_cron()
- 8.2 bynder.module \bynder_cron()
- 7 bynder.module \bynder_cron()
- 4.0.x bynder.module \bynder_cron()
Implements hook_cron().
File
- ./
bynder.module, line 259 - Provides bynder integration.
Code
function bynder_cron() {
update_bynder_media_usage_info();
$last_update = \Drupal::state()
->get('bynder_cache_last_update', 0);
if ($last_update && $last_update + \Drupal::config('default')
->get('cache_lifetime') < \Drupal::time()
->getRequestTime()) {
try {
\Drupal::service('bynder_api')
->updateCachedData();
} catch (\Exception $exception) {
\Drupal::logger('bynder')
->error(t('Unable to update Bynder caches. Check your <a href=":url">connection configuration</a>.', [
':url' => Url::fromRoute('bynder.configuration_form')
->toString(),
]));
}
}
}