summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/common.php5
-rw-r--r--inc/parserutils.php27
2 files changed, 25 insertions, 7 deletions
diff --git a/inc/common.php b/inc/common.php
index 88891af74..8b21c0585 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -56,6 +56,11 @@ function pageinfo(){
global $USERINFO;
global $conf;
+ // include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
+ // FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
+ $info['id'] = $ID;
+ $info['rev'] = $REV;
+
if($_SERVER['REMOTE_USER']){
$info['userinfo'] = $USERINFO;
$info['perm'] = auth_quickaclcheck($ID);
diff --git a/inc/parserutils.php b/inc/parserutils.php
index 17f1811ae..468ffe5c6 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -222,15 +222,21 @@ function p_get_instructions($text){
* @author Esther Brunner <esther@kaffeehaus.ch>
*/
function p_get_metadata($id, $key=false, $render=false){
- $file = metaFN($id, '.meta');
+ global $INFO;
- if (@file_exists($file)) $meta = unserialize(io_readFile($file, false));
- else $meta = array();
+ if ($id == $INFO['id'] && !empty($INFO['meta'])) {
+ $meta = $INFO['meta'];
+ } else {
+ $file = metaFN($id, '.meta');
+
+ if (@file_exists($file)) $meta = unserialize(io_readFile($file, false));
+ else $meta = array();
- // metadata has never been rendered before - do it!
- if ($render && !$meta['description']['abstract']){
- $meta = p_render_metadata($id, $meta);
- io_saveFile($file, serialize($meta));
+ // metadata has never been rendered before - do it!
+ if ($render && !$meta['description']['abstract']){
+ $meta = p_render_metadata($id, $meta);
+ io_saveFile($file, serialize($meta));
+ }
}
// filter by $key
@@ -283,6 +289,13 @@ function p_set_metadata($id, $data, $render=false){
// save only if metadata changed
if ($meta == $orig) return true;
+
+ // check if current page metadata has been altered - if so sync the changes
+ global $INFO;
+ if ($id == $INFO['id'] && isset($INFO['meta'])) {
+ $INFO['meta'] = $meta;
+ }
+
return io_saveFile(metaFN($id, '.meta'), serialize($meta));
}