Fix sitemaps added multiple times in index file
authorjoshuaruesweg <ruesweg@woltlab.com>
Thu, 11 Jun 2020 19:06:06 +0000 (21:06 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Thu, 11 Jun 2020 19:06:38 +0000 (21:06 +0200)
wcfsetup/install/files/lib/system/worker/SitemapRebuildWorker.class.php

index c589e42b014ddae6d507400ba683ea5136bb22f9..032e438aaaacd2d23044f48d774facddad842715 100755 (executable)
@@ -222,11 +222,8 @@ class SitemapRebuildWorker extends AbstractWorker {
        protected function checkCache() {
                $object = (isset($this->sitemapObjects[$this->workerData['sitemap']])) ? $this->sitemapObjects[$this->workerData['sitemap']] : false;
                while ($object && file_exists(self::getSitemapPath() . $object->objectType . '.xml') && filectime(self::getSitemapPath() . $object->objectType . '.xml') > TIME_NOW - (($object->rebuildTime !== null) ? $object->rebuildTime : 60 * 60 * 24 * 7)) {
-                       $files = @glob(self::getSitemapPath() . $object->objectType . '*');
-                       if (is_array($files)) {
-                               foreach ($files as $filename) {
-                                       $this->workerData['sitemaps'][] = self::getSitemapURL() . basename($filename);
-                               }
+                       foreach (array_merge(glob(self::getSitemapPath() . $object->objectType . '_*'), [self::getSitemapPath() . $object->objectType . '.xml']) as $filename) {
+                               $this->workerData['sitemaps'][] = self::getSitemapURL() . basename($filename);
                        }
                        
                        $this->workerData['sitemap']++;