Commit b946e977 authored by andrei.dincu's avatar andrei.dincu

Issue #2249723 by andrei.dincu: Replace cache_get(),cache_set() and...

Issue #2249723 by andrei.dincu: Replace cache_get(),cache_set() and user_access() with D8 methods in .inc and .module files
parent 249192a5
......@@ -49,21 +49,20 @@ function _xmlsitemap_get_version() {
function xmlsitemap_check_status() {
$messages = &drupal_static(__FUNCTION__);
/*
if (!isset($messages)) {
// Cache the list of modules that are checked.
if ($cache = cache_get('xmlsitemap:registry:requirements')) {
if ($cache = \Drupal::cache()->get('xmlsitemap:registry:requirements')) {
$modules = $cache->data;
}
else {
$modules = array();
module_load_all_includes('install');
\Drupal::moduleHandler()->loadAllIncludes('install');
foreach (module_implements('requirements') as $module) {
if (strpos($module, 'xmlsitemap') !== FALSE) {
$modules[] = $module;
}
}
cache_set('xmlsitemap:registry:requirements', $modules);
\Drupal::cache()->set('xmlsitemap:registry:requirements', $modules);
}
$messages = array();
......@@ -79,12 +78,12 @@ function xmlsitemap_check_status() {
if ($messages) {
$message = t('One or more problems were detected with your XML sitemap configuration: !messages', array('!messages' => theme('item_list', array('items' => $messages))));
if (user_access('access site reports')) {
if (\Drupal::currentUser()->hasPermission('access site reports')) {
$message .= t('Check the <a href="@status-report">status report</a> for more information.', array('@status-report' => url('admin/reports/status')));
}
drupal_set_message($message, 'warning', FALSE);
}
}
*/
return !empty($messages);
}
......@@ -917,7 +917,7 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
if (!isset($link_info)) {
$cid = 'xmlsitemap:link_info:' . $language->language;
if ($cache = cache_get($cid)) {
if ($cache = \Drupal::cache()->get($cid)) {
$link_info = $cache->data;
}
else {
......@@ -956,7 +956,7 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
drupal_alter('xmlsitemap_link_info', $link_info);
ksort($link_info);
// Cache by language since this info contains translated strings.
cache_set($cid, $link_info);
\Drupal::cache()->set($cid, $link_info);
}
}
......@@ -1421,7 +1421,7 @@ function xmlsitemap_get_context_info($context = NULL, $reset = FALSE) {
if ($reset) {
$info = NULL;
}
elseif ($cached = cache_get('xmlsitemap:context_info:' . $language->language)) {
elseif ($cached = \Drupal::cache()->get('xmlsitemap:context_info:' . $language->language)) {
$info = $cached->data;
}
......@@ -1430,7 +1430,7 @@ function xmlsitemap_get_context_info($context = NULL, $reset = FALSE) {
drupal_alter('xmlsitemap_context_info', $info);
ksort($info);
// Cache by language since this info contains translated strings.
cache_set('xmlsitemap:context_info:' . $language->language, $info);
\Drupal::cache()->set('xmlsitemap:context_info:' . $language->language, $info);
}
if (isset($context)) {
......
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