From 6655594104ece4bf91bb05e078a47b2d0be8db46 Mon Sep 17 00:00:00 2001 From: Szymon Olewniczak Date: Wed, 7 Apr 2021 14:35:36 +0200 Subject: [PATCH 1/2] New noinstructionscache flag This commit adds a new flag: noinstructionscache to plugin syntax. This flag forces not to use an instruction cache for the included page. This flag allows using the struct serial aggregation inside the included page. More generally, it allows using any DokuWiki syntax which instructions are dependant on the current page id, inside the included page. --- helper.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/helper.php b/helper.php index e1084f1..1970218 100644 --- a/helper.php +++ b/helper.php @@ -220,6 +220,9 @@ function get_flags($setflags) { case 'exclude': $flags['exclude'] = $value; break; + case 'noinstructionscache': + $flags['noinstructionscache'] = 1; + break; } } // the include_content URL parameter overrides flags @@ -266,7 +269,11 @@ function _get_instructions($page, $sect, $mode, $lvl, $flags, $root_id = null, $ global $ID; $backupID = $ID; $ID = $page; // Change the global $ID as otherwise plugins like the discussion plugin will save data for the wrong page - $ins = p_cached_instructions(wikiFN($page), false, $page); + if ($flags['noinstructionscache']) { + $ins = p_get_instructions(io_readWikiPage(wikiFN($page), $page)); + } else { + $ins = p_cached_instructions(wikiFN($page), false, $page); + } $ID = $backupID; } else { $ins = array(); From 711d7448b2b5f2d6c871f6bc6dbc905e02289f0a Mon Sep 17 00:00:00 2001 From: Szymon Olewniczak Date: Thu, 26 Aug 2021 13:52:13 +0200 Subject: [PATCH 2/2] fix: don't show notice when the noinstructionscache flag is not set --- conf/default.php | 1 + conf/metadata.php | 1 + helper.php | 1 + lang/en/settings.php | 1 + 4 files changed, 4 insertions(+) diff --git a/conf/default.php b/conf/default.php index c619005..7c0d830 100644 --- a/conf/default.php +++ b/conf/default.php @@ -27,4 +27,5 @@ $conf['depth'] = 1; // maximum depth of namespace includes, 0 for unlimited depth $conf['readmore'] = 1; // Show readmore link in case of firstsection only $conf['debugoutput'] = 0; // print debug information to debuglog if global allowdebug is enabled +$conf['noinstructionscache'] = 0;// don't use instructions cache during rendering included page content //Setup VIM: ex: et ts=2 : diff --git a/conf/metadata.php b/conf/metadata.php index a0fa7b1..188d2f3 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -30,4 +30,5 @@ $meta['depth'] = array('numeric', '_min' => 0); $meta['readmore'] = array('onoff'); $meta['debugoutput'] = array('onoff'); +$meta['noinstructionscache'] = array('onoff'); //Setup VIM: ex: et ts=2 : diff --git a/helper.php b/helper.php index 1970218..8e2802f 100644 --- a/helper.php +++ b/helper.php @@ -46,6 +46,7 @@ function __construct() { $this->defaults['rsort'] = $this->getConf('rsort'); $this->defaults['depth'] = $this->getConf('depth'); $this->defaults['readmore'] = $this->getConf('readmore'); + $this->defaults['noinstructionscache'] = $this->getConf('noinstructionscache'); } /** diff --git a/lang/en/settings.php b/lang/en/settings.php index 8aec307..e6667b8 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -38,4 +38,5 @@ $lang['depth'] = 'Maximum depth of namespace includes, 0 for unlimited depth'; $lang['readmore'] = 'Show or not the \'Read More\' link in case of firstsection only'; $lang['debugoutput'] = 'Print verbose debug information to the dokuwiki debuglog if the global "allowdebug" option is enabled'; +$lang['noinstructionscache'] = 'Don\'t use instructions cache during rendering included page content.'; //Setup VIM: ex: et ts=2 :