Commit 181a3a68 authored by andrei.dincu's avatar andrei.dincu

Issue #2249723 by andrei.dincu: Move xmlsitemap_modules_enabled() to...

Issue #2249723 by andrei.dincu: Move xmlsitemap_modules_enabled() to xmlsitemap_modules_installed() and xmlsitemap_modules_disabled() to xmlsitemap_modules_uninstalled(). Set cache tag xmlsitemap for cache data
parent ddcfcdd5
......@@ -19,6 +19,7 @@ use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\Core\Cache\Cache;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Response;
......@@ -184,17 +185,17 @@ function xmlsitemap_cron() {
}
/**
* Implements hook_modules_enabled().
* Implements hook_modules_installed().
*/
function xmlsitemap_modules_enabled(array $modules) {
cache_clear_all('xmlsitemap:', 'cache', TRUE);
function xmlsitemap_modules_installed(array $modules) {
\Drupal::cache()->deleteTags(array('xmlsitemap'));
}
/**
* Implements hook_modules_disabled().
* Implements hook_modules_uninstalled().
*/
function xmlsitemap_modules_disabled(array $modules) {
cache_clear_all('xmlsitemap:', 'cache', TRUE);
function xmlsitemap_modules_uninstalled(array $modules) {
\Drupal::cache()->deleteTags(array('xmlsitemap'));
}
/**
......@@ -659,7 +660,7 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
\Drupal::moduleHandler()->alter('xmlsitemap_link_info', $link_info);
ksort($link_info);
// Cache by language since this info contains translated strings.
\Drupal::cache()->set($cid, $link_info);
\Drupal::cache()->set($cid, $link_info, Cache::PERMANENT, array('xmlsitemap'));
}
}
......@@ -1353,7 +1354,7 @@ function xmlsitemap_get_context_info($context = NULL, $reset = FALSE) {
\Drupal::moduleHandler()->alter('xmlsitemap_context_info', $info);
ksort($info);
// Cache by language since this info contains translated strings.
\Drupal::cache()->set('xmlsitemap:context_info:' . $language->getId(), $info);
\Drupal::cache()->set('xmlsitemap:context_info:' . $language->getId(), $info, Cache::PERMANENT, array('xmlsitemap'));
}
if (isset($context)) {
......@@ -2389,7 +2390,7 @@ function xmlsitemap_check_status() {
$modules[] = $module;
}
}
\Drupal::cache()->set('xmlsitemap:registry:requirements', $modules);
\Drupal::cache()->set('xmlsitemap:registry:requirements', $modules, Cache::PERMANENT, array('xmlsitemap'));
}
$messages = array();
......
......@@ -2,6 +2,7 @@
use Drupal\Core\Routing\RouteMatchInterface;
use GuzzleHttp\Exception\RequestException;
use Drupal\Core\Cache\Cache;
/**
* Implements hook_hook_info().
......@@ -58,11 +59,6 @@ function xmlsitemap_engines_submit_access() {
return FALSE;
}
// Allow manual submissions to run.
//if ($_GET['q'] == 'admin/config/search/xmlsitemap/engines/submit' && user_access('administer xmlsitemap')) {
// return TRUE;
//}
$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');
......@@ -174,7 +170,7 @@ function xmlsitemap_engines_get_engine_info($engine = NULL) {
// Allow other modulse to alter the engine info.
\Drupal::moduleHandler()->alter('xmlsitemap_engine_info', $engines);
// Cache by language since engine names are translated.
\Drupal::cache()->set('xmlsitemap:engines:' . $language->getId(), $engines);
\Drupal::cache()->set('xmlsitemap:engines:' . $language->getId(), $engines, Cache::PERMANENT, array('xmlsitemap'));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment