[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [BP][FIX] Sitemap: Make url argument optional to prevent scheduler failure

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a2d4c6c3d34_381a3628751fa@gitlab-sidekiq-low-urgency-cpu-bound-v2-c9f44b7d4-nxt6n.mail>

ushindi bienvenu pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
0afa1c8f by Landry Bitege at 2026-06-13T12:20:55+00:00
[BP][FIX] Sitemap: Make url argument optional to prevent scheduler failure
---
* [FIX] Sitemap: Make url argument optional to prevent scheduler failure
---
* [FIX] Sitemap: Make url argument optional to prevent scheduler failure

See merge request tikiwiki/tiki!10145

(cherry picked from commit db3843bdd3f8aadeeb48cfcfd071617ec69b9b0a)

See merge request tikiwiki/tiki!10510

- - - - -


3 changed files:

- + installer/schema/20260508_fix_sitemap_scheduler_url_tiki.php
- lib/core/Scheduler/DefaultSchedulers.php
- lib/core/Tiki/Sitemap/Type/Pages.php


Changes:

=====================================
installer/schema/20260508_fix_sitemap_scheduler_url_tiki.php
=====================================
@@ -0,0 +1,42 @@
+<?php
+
+// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+//
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+
+use Tiki\Installer\Installer;
+
+/**
+ * Update existing sitemap:generate scheduler tasks to include the site URL,
+ * fixing scheduler failure caused by the missing required url argument.
+ *
+ * @param Installer $installer
+ * @return bool
+ */
+function upgrade_20260508_fix_sitemap_scheduler_url_tiki(Installer $installer): bool
+{
+    $url = TikiLib::tikiUrl();
+
+    if (empty($url)) {
+        return true;
+    }
+
+    $tasks = $installer->fetchAll(
+        "SELECT id, params FROM tiki_scheduler WHERE task = 'ConsoleCommandTask'"
+    );
+
+    foreach ($tasks as $task) {
+        $params = json_decode($task['params'], true);
+
+        if (isset($params['console_command']) && $params['console_command'] === 'sitemap:generate') {
+            $params['console_command'] = 'sitemap:generate ' . $url;
+            $installer->query(
+                "UPDATE tiki_scheduler SET params = ? WHERE id = ?",
+                [json_encode($params), $task['id']]
+            );
+        }
+    }
+
+    return true;
+}


=====================================
lib/core/Scheduler/DefaultSchedulers.php
=====================================
@@ -40,7 +40,7 @@ class DefaultSchedulers
                 'name' => tr('Generate sitemap daily'),
                 'description' => tr('Generate the sitemap daily at 02:00.'),
                 'task' => 'ConsoleCommandTask',
-                'params' => json_encode(['console_command' => 'sitemap:generate']),
+                'params' => json_encode(['console_command' => 'sitemap:generate ' . TikiLib::tikiUrl()]),
                 'run_time' => '0 2 * * *'
             ],[
                 'name' => tr('Rebuild preferences index every Sunday'),


=====================================
lib/core/Tiki/Sitemap/Type/Pages.php
=====================================
@@ -57,7 +57,7 @@ class Pages extends AbstractType
 
         $attributes = TikiLib::lib('attribute')->getAllAttributes("tiki.object.sitemap");
         $listPages['data'] = array_filter($listPages['data'], function ($page) use ($attributes) {
-            if ($attributes[$page['pageName']] !== 'n') {
+            if (isset($attributes[$page['pageName']]) && $attributes[$page['pageName']] !== 'n') {
                 return ($page);
             }
         });



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0afa1c8f1c97d834eeb6dfe99a7b6b2ed1cd366b

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0afa1c8f1c97d834eeb6dfe99a7b6b2ed1cd366b
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.