From a0edef313c737cb62d75d9101c7a00752110345d Mon Sep 17 00:00:00 2001
From: Brian Canini <canini.16@osu.edu>
Date: Thu, 18 Jun 2020 14:38:15 -0400
Subject: [PATCH] Updating drupal/simple_sitemap (3.6.0 => 3.7.0)

---
 composer.json                                 |  2 +-
 composer.lock                                 | 26 +++++++--------
 vendor/composer/installed.json                | 26 +++++++--------
 web/modules/simple_sitemap/composer.json      |  2 +-
 .../simple_sitemap_engines.info.yml           |  6 ++--
 .../simple_sitemap_views.info.yml             |  6 ++--
 .../simple_sitemap_views_test.info.yml        |  6 ++--
 .../simple_sitemap/simple_sitemap.info.yml    |  6 ++--
 .../simple_sitemap/simple_sitemap.install     |  2 +-
 .../simple_sitemap/simple_sitemap.module      |  7 ++--
 .../simple_sitemap.services.yml               |  2 ++
 .../src/Form/SimplesitemapSitemapsForm.php    | 33 ++++++++-----------
 .../SitemapGenerator/SitemapGeneratorBase.php |  2 +-
 .../SitemapGenerator/SitemapWriter.php        | 19 +++++++++--
 .../src/Functional/SimplesitemapTest.php      | 10 +++---
 15 files changed, 79 insertions(+), 76 deletions(-)

diff --git a/composer.json b/composer.json
index eb2b8f4ccc..5fe3bf0059 100644
--- a/composer.json
+++ b/composer.json
@@ -161,7 +161,7 @@
         "drupal/search_api_db": "1.1",
         "drupal/simple_gmap": "2.0",
         "drupal/simple_megamenu": "1.0-beta3",
-        "drupal/simple_sitemap": "3.6",
+        "drupal/simple_sitemap": "3.7",
         "drupal/simplesamlphp_auth": "3.1",
         "drupal/smtp": "1.x-dev#84f789cbba894290cf82ed2558c8a4e7e24f3c89",
         "drupal/social_media": "1.8",
diff --git a/composer.lock b/composer.lock
index e3b40ec0fc..cc9ca27bf2 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "58715021b0129ecbef2bc04e2432d3f1",
+    "content-hash": "85c05449f480fd0a4b9d77b4977e241a",
     "packages": [
         {
             "name": "alchemy/zippy",
@@ -7239,17 +7239,17 @@
         },
         {
             "name": "drupal/simple_sitemap",
-            "version": "3.6.0",
+            "version": "3.7.0",
             "source": {
                 "type": "git",
                 "url": "https://git.drupalcode.org/project/simple_sitemap.git",
-                "reference": "8.x-3.6"
+                "reference": "8.x-3.7"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://ftp.drupal.org/files/projects/simple_sitemap-8.x-3.6.zip",
-                "reference": "8.x-3.6",
-                "shasum": "37fc0ae98a4ccb23316cb089ae4839913e80cbf6"
+                "url": "https://ftp.drupal.org/files/projects/simple_sitemap-8.x-3.7.zip",
+                "reference": "8.x-3.7",
+                "shasum": "7b23930cc71d37f332c1e836bc18c29ed2ae8cde"
             },
             "require": {
                 "drupal/core": "^8 || ^9",
@@ -7258,8 +7258,8 @@
             "type": "drupal-module",
             "extra": {
                 "drupal": {
-                    "version": "8.x-3.6",
-                    "datestamp": "1586469908",
+                    "version": "8.x-3.7",
+                    "datestamp": "1592298918",
                     "security-coverage": {
                         "status": "covered",
                         "message": "Covered by Drupal's security advisory policy"
@@ -7273,7 +7273,7 @@
             },
             "notification-url": "https://packages.drupal.org/8/downloads",
             "license": [
-                "GPL-2.0+"
+                "GPL-2.0-or-later"
             ],
             "authors": [
                 {
@@ -7281,10 +7281,6 @@
                     "homepage": "https://www.drupal.org/u/gbyte.co",
                     "email": "contact@gbyte.co",
                     "role": "Maintainer"
-                },
-                {
-                    "name": "gbyte.co",
-                    "homepage": "https://www.drupal.org/user/2381352"
                 }
             ],
             "description": "Creates a standard conform hreflang XML sitemap of the site content and provides a framework for developing other sitemap types.",
@@ -8817,12 +8813,12 @@
             "version": "0.9.1",
             "source": {
                 "type": "git",
-                "url": "https://github.com/njh/easyrdf.git",
+                "url": "https://github.com/easyrdf/easyrdf.git",
                 "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/njh/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566",
+                "url": "https://api.github.com/repos/easyrdf/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566",
                 "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566",
                 "shasum": ""
             },
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 13ca36e6c0..786bad0ee7 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -7461,18 +7461,18 @@
     },
     {
         "name": "drupal/simple_sitemap",
-        "version": "3.6.0",
-        "version_normalized": "3.6.0.0",
+        "version": "3.7.0",
+        "version_normalized": "3.7.0.0",
         "source": {
             "type": "git",
             "url": "https://git.drupalcode.org/project/simple_sitemap.git",
-            "reference": "8.x-3.6"
+            "reference": "8.x-3.7"
         },
         "dist": {
             "type": "zip",
-            "url": "https://ftp.drupal.org/files/projects/simple_sitemap-8.x-3.6.zip",
-            "reference": "8.x-3.6",
-            "shasum": "37fc0ae98a4ccb23316cb089ae4839913e80cbf6"
+            "url": "https://ftp.drupal.org/files/projects/simple_sitemap-8.x-3.7.zip",
+            "reference": "8.x-3.7",
+            "shasum": "7b23930cc71d37f332c1e836bc18c29ed2ae8cde"
         },
         "require": {
             "drupal/core": "^8 || ^9",
@@ -7481,8 +7481,8 @@
         "type": "drupal-module",
         "extra": {
             "drupal": {
-                "version": "8.x-3.6",
-                "datestamp": "1586469908",
+                "version": "8.x-3.7",
+                "datestamp": "1592298918",
                 "security-coverage": {
                     "status": "covered",
                     "message": "Covered by Drupal's security advisory policy"
@@ -7497,7 +7497,7 @@
         "installation-source": "dist",
         "notification-url": "https://packages.drupal.org/8/downloads",
         "license": [
-            "GPL-2.0+"
+            "GPL-2.0-or-later"
         ],
         "authors": [
             {
@@ -7505,10 +7505,6 @@
                 "homepage": "https://www.drupal.org/u/gbyte.co",
                 "email": "contact@gbyte.co",
                 "role": "Maintainer"
-            },
-            {
-                "name": "gbyte.co",
-                "homepage": "https://www.drupal.org/user/2381352"
             }
         ],
         "description": "Creates a standard conform hreflang XML sitemap of the site content and provides a framework for developing other sitemap types.",
@@ -9090,12 +9086,12 @@
         "version_normalized": "0.9.1.0",
         "source": {
             "type": "git",
-            "url": "https://github.com/njh/easyrdf.git",
+            "url": "https://github.com/easyrdf/easyrdf.git",
             "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/njh/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566",
+            "url": "https://api.github.com/repos/easyrdf/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566",
             "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566",
             "shasum": ""
         },
diff --git a/web/modules/simple_sitemap/composer.json b/web/modules/simple_sitemap/composer.json
index 2f92ef5cb0..18450ea707 100644
--- a/web/modules/simple_sitemap/composer.json
+++ b/web/modules/simple_sitemap/composer.json
@@ -16,7 +16,7 @@
     "irc": "irc://irc.freenode.org/drupal-contribute",
     "source": "https://cgit.drupalcode.org/simple_sitemap"
   },
-  "license": "GPL-2.0+",
+  "license": "GPL-2.0-or-later",
   "minimum-stability": "dev",
   "require": {
     "ext-xmlwriter": "*"
diff --git a/web/modules/simple_sitemap/modules/simple_sitemap_engines/simple_sitemap_engines.info.yml b/web/modules/simple_sitemap/modules/simple_sitemap_engines/simple_sitemap_engines.info.yml
index b8ff3f6eb8..0ef2cb06a9 100644
--- a/web/modules/simple_sitemap/modules/simple_sitemap_engines/simple_sitemap_engines.info.yml
+++ b/web/modules/simple_sitemap/modules/simple_sitemap_engines/simple_sitemap_engines.info.yml
@@ -8,7 +8,7 @@ core_version_requirement: ^8 || ^9
 dependencies:
   - simple_sitemap:simple_sitemap
 
-# Information added by Drupal.org packaging script on 2020-04-09
-version: '8.x-3.6'
+# Information added by Drupal.org packaging script on 2020-06-16
+version: '8.x-3.7'
 project: 'simple_sitemap'
-datestamp: 1586468195
+datestamp: 1592298876
diff --git a/web/modules/simple_sitemap/modules/simple_sitemap_views/simple_sitemap_views.info.yml b/web/modules/simple_sitemap/modules/simple_sitemap_views/simple_sitemap_views.info.yml
index a569a3365d..11e2a8680e 100644
--- a/web/modules/simple_sitemap/modules/simple_sitemap_views/simple_sitemap_views.info.yml
+++ b/web/modules/simple_sitemap/modules/simple_sitemap_views/simple_sitemap_views.info.yml
@@ -9,7 +9,7 @@ dependencies:
   - simple_sitemap:simple_sitemap
   - drupal:views
 
-# Information added by Drupal.org packaging script on 2020-04-09
-version: '8.x-3.6'
+# Information added by Drupal.org packaging script on 2020-06-16
+version: '8.x-3.7'
 project: 'simple_sitemap'
-datestamp: 1586468195
+datestamp: 1592298876
diff --git a/web/modules/simple_sitemap/modules/simple_sitemap_views/tests/modules/simple_sitemap_views_test/simple_sitemap_views_test.info.yml b/web/modules/simple_sitemap/modules/simple_sitemap_views/tests/modules/simple_sitemap_views_test/simple_sitemap_views_test.info.yml
index f7885e48a5..46a2a9cb6d 100644
--- a/web/modules/simple_sitemap/modules/simple_sitemap_views/tests/modules/simple_sitemap_views_test/simple_sitemap_views_test.info.yml
+++ b/web/modules/simple_sitemap/modules/simple_sitemap_views/tests/modules/simple_sitemap_views_test/simple_sitemap_views_test.info.yml
@@ -7,7 +7,7 @@ core_version_requirement: ^8 || ^9
 dependencies:
   - simple_sitemap:simple_sitemap_views
 
-# Information added by Drupal.org packaging script on 2020-04-09
-version: '8.x-3.6'
+# Information added by Drupal.org packaging script on 2020-06-16
+version: '8.x-3.7'
 project: 'simple_sitemap'
-datestamp: 1586468195
+datestamp: 1592298876
diff --git a/web/modules/simple_sitemap/simple_sitemap.info.yml b/web/modules/simple_sitemap/simple_sitemap.info.yml
index 48227d551b..ad557ba9d4 100644
--- a/web/modules/simple_sitemap/simple_sitemap.info.yml
+++ b/web/modules/simple_sitemap/simple_sitemap.info.yml
@@ -6,7 +6,7 @@ package: SEO
 core: 8.x
 core_version_requirement: ^8 || ^9
 
-# Information added by Drupal.org packaging script on 2020-04-09
-version: '8.x-3.6'
+# Information added by Drupal.org packaging script on 2020-06-16
+version: '8.x-3.7'
 project: 'simple_sitemap'
-datestamp: 1586468195
+datestamp: 1592298876
diff --git a/web/modules/simple_sitemap/simple_sitemap.install b/web/modules/simple_sitemap/simple_sitemap.install
index 7569b242ff..0037c822a0 100644
--- a/web/modules/simple_sitemap/simple_sitemap.install
+++ b/web/modules/simple_sitemap/simple_sitemap.install
@@ -122,7 +122,7 @@ function simple_sitemap_schema() {
         'default' => 0,
       ],
       'status' => [
-        'description' => "Flag indicating the publishing status of the chunk.",
+        'description' => 'Flag indicating the publishing status of the chunk.',
         'type' => 'int',
         'size' => 'tiny',
         'not null' => TRUE,
diff --git a/web/modules/simple_sitemap/simple_sitemap.module b/web/modules/simple_sitemap/simple_sitemap.module
index 6ac0a6cbfa..edf3b81a87 100644
--- a/web/modules/simple_sitemap/simple_sitemap.module
+++ b/web/modules/simple_sitemap/simple_sitemap.module
@@ -13,15 +13,16 @@
 use Drupal\language\ConfigurableLanguageInterface;
 
 /**
- *Implements hook_help().
+ * Implements hook_help().
  *
  * @param $route_name
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  * @return \Drupal\Component\Render\MarkupInterface|null
  */
 function simple_sitemap_help($route_name, RouteMatchInterface $route_match) {
-  return $route_name === 'help.page.simple_sitemap' ?
-    check_markup(file_get_contents(dirname(__FILE__) . "/README.md")) : NULL;
+  return $route_name === 'help.page.simple_sitemap'
+    ? check_markup(file_get_contents(__DIR__ . '/README.md'))
+    : NULL;
 }
 
 /**
diff --git a/web/modules/simple_sitemap/simple_sitemap.services.yml b/web/modules/simple_sitemap/simple_sitemap.services.yml
index 8d89aa6351..1e28807b4a 100644
--- a/web/modules/simple_sitemap/simple_sitemap.services.yml
+++ b/web/modules/simple_sitemap/simple_sitemap.services.yml
@@ -51,6 +51,8 @@ services:
   simple_sitemap.sitemap_writer:
     class: Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator\SitemapWriter
     public: true
+    arguments:
+      - '@router.route_provider'
 
   simple_sitemap.entity_helper:
     class: Drupal\simple_sitemap\EntityHelper
diff --git a/web/modules/simple_sitemap/src/Form/SimplesitemapSitemapsForm.php b/web/modules/simple_sitemap/src/Form/SimplesitemapSitemapsForm.php
index b637a3ab2e..df316db489 100644
--- a/web/modules/simple_sitemap/src/Form/SimplesitemapSitemapsForm.php
+++ b/web/modules/simple_sitemap/src/Form/SimplesitemapSitemapsForm.php
@@ -152,38 +152,31 @@ public function buildForm(array $form, FormStateInterface $form_state) {
           '#attributes' => ['class' => ['form-item', 'clearfix']],
         ];
         foreach ($variants as $variant_name => $variant_definition) {
-          $row = [];
-          switch ($sitemap_statuses[$variant_name]) {
-            case 0:
-              $row['name']['data']['#markup'] = '<span title="' . $variant_name . '">' . $this->t($variant_definition['label']) . '</span>';
-              break;
-            case 1:
-            case 2:
-              $row['name']['data']['#markup'] = $this->t('<a href="@url" target="_blank">@variant</a>',
-                ['@url' => $sitemap_generator->setSitemapVariant($variant_name)->getSitemapUrl(), '@variant' => $this->t($variant_definition['label'])]
-              );
-              break;
-          }
           if (!isset($sitemap_statuses[$variant_name])) {
+            $row['name']['data']['#markup'] = '<span title="' . $variant_name . '">' . $this->t($variant_definition['label']) . '</span>';
             $row['status'] = $this->t('pending');
           }
           else {
             switch ($sitemap_statuses[$variant_name]) {
+
               case 0:
+                $row['name']['data']['#markup'] = '<span title="' . $variant_name . '">' . $this->t($variant_definition['label']) . '</span>';
                 $row['status'] = $this->t('generating');
                 break;
+
               case 1:
-                $row['status'] = $this->t('published on @time', ['@time' => $this->dateFormatter->format($published_timestamps[$variant_name])]
-                );
-                break;
               case 2:
-                $row['status'] = $this->t('published on @time, regenerating',
-                  ['@url' => $sitemap_generator->setSitemapVariant($variant_name)->getSitemapUrl(), '@time' => $this->dateFormatter->format($published_timestamps[$variant_name])]
+                $row['name']['data']['#markup'] = $this->t('<a href="@url" target="_blank">@variant</a>',
+                  ['@url' => $sitemap_generator->setSitemapVariant($variant_name)->getSitemapUrl(), '@variant' => $this->t($variant_definition['label'])]
                 );
+                $row['status'] = $this->t(($sitemap_statuses[$variant_name] === 1
+                  ? 'published on @time'
+                  : 'published on @time, regenerating'
+                ), ['@time' => $this->dateFormatter->format($published_timestamps[$variant_name])]);
                 break;
             }
           }
-          $form['simple_sitemap_settings']['status']['types'][$type_name]['table']['#rows'][$variant_name] = $row;
+          $form['simple_sitemap_settings']['status']['types'][$type_name]['table']['#rows'][$variant_name] = isset($row) ? $row : [];
           unset($sitemap_statuses[$variant_name]);
         }
       }
@@ -203,7 +196,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    *  1: Instance is published
    *  2: Instance is published but is being regenerated
    *
-   * @todo Move to SitemapGeneratorBase or DefaultSitemapGenerator so it can be overwritten by sitemap types with custom storages.
+   * @todo Implement SitemapGeneratorBase::isPublished() per sitemap instead or at least return a constant.
    */
   protected function fetchSitemapInstanceStatuses() {
     $results = $this->db
@@ -223,7 +216,7 @@ protected function fetchSitemapInstanceStatuses() {
   /**
    * @return array
    *
-   * @todo Move to SitemapGeneratorBase or DefaultSitemapGenerator so it can be overwritten by sitemap types with custom storages.
+   * @todo Implement SitemapGeneratorBase::getPublishedTimestamp() per sitemap instead or at least return a constant.
    */
   protected function fetchSitemapInstancePublishedTimestamps() {
     return $this->db
diff --git a/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php b/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php
index 937ed0160e..7ca401fb6e 100644
--- a/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php
+++ b/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapGeneratorBase.php
@@ -351,7 +351,7 @@ public function getSitemapUrl($delta = NULL) {
   public static function isMultilingualSitemap() {
     $has_multiple_indexable_languages = count(
         array_diff_key(\Drupal::languageManager()->getLanguages(),
-          \Drupal::service('simple_sitemap.generator')->getSetting('excluded_languages'))
+          \Drupal::service('simple_sitemap.generator')->getSetting('excluded_languages', []))
       ) > 1;
 
     return $has_multiple_indexable_languages
diff --git a/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapWriter.php b/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapWriter.php
index f9a764a05c..36b52dbeea 100644
--- a/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapWriter.php
+++ b/web/modules/simple_sitemap/src/Plugin/simple_sitemap/SitemapGenerator/SitemapWriter.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator;
 
-use Drupal\Core\Url;
+use Drupal\Core\Routing\RouteProvider;
 
 /**
  * Class SitemapWriter
@@ -14,11 +14,26 @@ class SitemapWriter extends \XMLWriter {
   const XML_VERSION = '1.0';
   const ENCODING = 'UTF-8';
 
+  /**
+   * @var \Drupal\Core\Routing\RouteProvider
+   */
+  protected $routeProvider;
+
+  public function __construct(RouteProvider $route_provider) {
+    $this->routeProvider = $route_provider;
+  }
+
   /**
    * Adds the XML stylesheet to the XML page.
    */
   public function writeXsl() {
-    $xsl_url = Url::fromRoute('simple_sitemap.sitemap_xsl')->toString();
+    // Use this instead of URL::fromRoute() to avoid creating a URL with the
+    // subdomain from which creation was triggered which might lead to a CORS
+    // problem. See https://www.drupal.org/project/simple_sitemap/issues/3131672.
+    $xsl_url = $this->routeProvider
+      ->getRouteByName('simple_sitemap.sitemap_xsl')
+      ->getPath();
+
     $this->writePI('xml-stylesheet', 'type="text/xsl" href="' . $xsl_url . '"');
   }
 
diff --git a/web/modules/simple_sitemap/tests/src/Functional/SimplesitemapTest.php b/web/modules/simple_sitemap/tests/src/Functional/SimplesitemapTest.php
index a29bca6743..d5e18d76b4 100644
--- a/web/modules/simple_sitemap/tests/src/Functional/SimplesitemapTest.php
+++ b/web/modules/simple_sitemap/tests/src/Functional/SimplesitemapTest.php
@@ -350,7 +350,7 @@ public function testSetEntityInstanceSettings() {
       ->condition('o.entity_id', $this->node->id())
       ->execute()
       ->fetchField();
-    $this->assertFalse(empty($result));
+    $this->assertNotEmpty($result);
 
     $this->generator->setBundleSettings('node', 'page', ['priority' => 0.1, 'changefreq' => 'never'])
       ->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
@@ -376,7 +376,7 @@ public function testSetEntityInstanceSettings() {
       ->condition('o.entity_id', $this->node->id())
       ->execute()
       ->fetchField();
-    $this->assertTrue(empty($result));
+    $this->assertEmpty($result);
   }
 
   /**
@@ -488,7 +488,7 @@ public function testSitemapVariants() {
       ->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
 
     $variants = $this->generator->getSitemapManager()->getSitemapVariants();
-    $this->assertTrue(isset($variants['test']));
+    $this->assertArrayHasKey('test', $variants);
 
     $this->drupalGet($this->defaultSitemapUrl);
     $this->assertSession()->responseContains('node/' . $this->node->id());
@@ -509,7 +509,7 @@ public function testSitemapVariants() {
     $this->generator->getSitemapManager()->removeSitemapVariants('test');
 
     $variants = $this->generator->getSitemapManager()->getSitemapVariants();
-    $this->assertFalse(isset($variants['test']));
+    $this->assertArrayNotHasKey('test', $variants);
 
     // Test if sitemap has been removed along with the variant.
     $this->drupalGet('test/sitemap.xml');
@@ -569,7 +569,7 @@ public function testGenerationResume($element_count, $generate_duration, $max_li
     $chunks = $this->database->query('SELECT id FROM {simple_sitemap} WHERE delta != 0 AND status = 1');
     $chunks->allowRowCount = TRUE;
     $chunk_count = $chunks->rowCount();
-    $this->assertTrue($chunk_count === $expected_sitemap_count);
+    $this->assertSame($chunk_count, $expected_sitemap_count);
 
     // Test if index has been created when necessary.
     $index = $this->database->query('SELECT id FROM {simple_sitemap} WHERE delta = 0 AND status = 1')
-- 
GitLab