Author: Tim Düsterhus (TimWolla)
Committer: Derick Rethans (derickr)
Date: 2025-09-23T08:55:19+01:00

Commit: 
https://github.com/php/web-wiki/commit/575aed30b4736c09f82b29f26541134b9c066b21
Raw diff: 
https://github.com/php/web-wiki/commit/575aed30b4736c09f82b29f26541134b9c066b21.diff

Fix doodle autocloser

Changed paths:
  M  dokuwiki/lib/plugins/doodle/syntax.php


Diff:

diff --git a/dokuwiki/lib/plugins/doodle/syntax.php 
b/dokuwiki/lib/plugins/doodle/syntax.php
index fcf07cff..e9f9ee4e 100755
--- a/dokuwiki/lib/plugins/doodle/syntax.php
+++ b/dokuwiki/lib/plugins/doodle/syntax.php
@@ -141,10 +141,6 @@ function handle($match, $state, $pos, Doku_Handler 
$handler) {
             if (strcmp($name, "CLOSEON") == 0) {
                 if (($timestamp = strtotime($value)) !== false) {
                     $params['close_on_ts'] = $timestamp;
-
-                    if (time() > $timestamp) {
-                        $params['closed'] = 1;
-                    }
                 }
             } else
             if (strcmp($name, "CLOSED") == 0) {
@@ -211,6 +207,14 @@ function render($mode, Doku_Renderer $renderer, $data) {
 
         //debout('data in render', $data);
 
+        // The auto-closer logic depends on the current time() and thus needs
+        // to happen in render(), since the result of handle() is cached.
+        if (isset($data['params']['close_on_ts'])) {
+            if (time() > $data['params']['close_on_ts']) {
+                $data['params']['closed'] = 1;
+            }
+        }
+
         $this->params    = $data['params'];
         $this->choices   = $data['choices'];
         $this->doodle    = array();

Reply via email to