function xmlsitemap_engines_submit_access in XML sitemap 8
Same name and namespace in other branches
- 6.2 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_submit_access()
- 7.2 xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_submit_access()
- 2.x xmlsitemap_engines/xmlsitemap_engines.module \xmlsitemap_engines_submit_access()
Submit access.
1 call to xmlsitemap_engines_submit_access()
- xmlsitemap_engines_cron in xmlsitemap_engines/
xmlsitemap_engines.module - Implements hook_cron().
File
- xmlsitemap_engines/
xmlsitemap_engines.module, line 70 - Main file for the XML sitemap engines.
Code
function xmlsitemap_engines_submit_access() {
if (!xmlsitemap_engines_can_submit()) {
return FALSE;
}
$submit_updated = \Drupal::state()
->get('xmlsitemap_engines_submit_updated');
$submitted_last = \Drupal::state()
->get('xmlsitemap_engines_submit_last');
$minimum_lifetime = \Drupal::config('xmlsitemap_engines.settings')
->get('minimum_lifetime');
// Skip if sitemap data has not been updated since last submission.
if ($submit_updated && \Drupal::state()
->get('xmlsitemap_generated_last') <= $submitted_last) {
return FALSE;
}
// Skip if the time since last submission is less than the minimum lifetime.
if (\Drupal::time()
->getRequestTime() - $submitted_last < $minimum_lifetime) {
return FALSE;
}
return TRUE;
}