Commit 72990774 authored by andrei.dincu's avatar andrei.dincu
Browse files

Issue #2249723 by andrei.dincu: xmlsitemap_get_context_hash() takes parameter...

Issue #2249723 by andrei.dincu: xmlsitemap_get_context_hash() takes parameter as reference and changes context in xmlsitemap.install
parent e110e4ad
......@@ -357,7 +357,7 @@ function xmlsitemap_install() {
$sitemap = \Drupal::entityManager()->getStorage('xmlsitemap')->create(array(
'id' => xmlsitemap_sitemap_get_context_hash($context),
));
$sitemap = $sitemap->setContext($context);
$sitemap = $sitemap->setContext(array());
$sitemap = $sitemap->setLabel(\Drupal::state()->get('base_url'));
$sitemap->save();
\Drupal::state()->setMultiple(array(
......
......@@ -395,9 +395,7 @@ function xmlsitemap_sitemap_load_multiple($smids = array(), array $conditions =
}
foreach ($sitemaps as &$sitemap) {
$sitemap->setContext($sitemap->getContext());
//$sitemap->setContext(unserialize($sitemap->getContext()));
$uri = xmlsitemap_sitemap_uri($sitemap);
$sitemap->setContext(serialize($sitemap->getContext()));
$sitemap->uri = $uri;
}
......@@ -447,7 +445,6 @@ function xmlsitemap_sitemap_save(XmlSitemapInterface $sitemap) {
//$sitemap->is_new = empty($sitemap->getId());
//$sitemap->old_smid = $sitemap->is_new ? NULL : $sitemap->smid;
$sitemap->setOriginalId($sitemap->isNew() ? NULL : $sitemap->getId());
//$sitemap->smid = xmlsitemap_sitemap_get_context_hash($sitemap->context);
$sitemap->setId(xmlsitemap_sitemap_get_context_hash($sitemap->getContext()));
// If the context was changed, we need to perform additional actions.
if (!$sitemap->isNew() && $sitemap->getId() != $sitemap->getOriginalId()) {
......@@ -525,9 +522,6 @@ function xmlsitemap_sitemap_get_max_filesize(XmlSitemapInterface $sitemap) {
}
function xmlsitemap_sitemap_get_context_hash(array &$context) {
if (is_string($context)) {
$context = unserialize($context);
}
asort($context);
return Crypt::hashBase64(serialize($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