function lti_tool_provider_cron in LTI Tool Provider 8
Same name and namespace in other branches
- 2.x lti_tool_provider.module \lti_tool_provider_cron()
Implements hook_cron().
File
- ./
lti_tool_provider.module, line 38 - LTI Tool Provider hook implementations and support functions.
Code
function lti_tool_provider_cron() {
$expires = time() - LTI_TOOL_PROVIDER_NONCE_EXPIRY;
try {
$nonceStorage = Drupal::entityTypeManager()
->getStorage('lti_tool_provider_nonce');
$ids = $nonceStorage
->getQuery()
->condition('timestamp', $expires, '<')
->execute();
$entities = $nonceStorage
->loadMultiple($ids);
$nonceStorage
->delete($entities);
} catch (Exception $e) {
Drupal::logger('lti_tool_provider')
->error($e
->getMessage());
}
}