diff options
author | Michael Hamann <michael@content-space.de> | 2010-12-27 22:51:06 +0100 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2010-12-27 22:51:06 +0100 |
commit | 69ba640bb6c63d2132ca401588053dfc507dbb1b (patch) | |
tree | 0ab999879296a015ca52712b1113c40d903aaa6f /inc/parserutils.php | |
parent | ab2d4a059f13bd1f10150e3408c41e80f7b94715 (diff) | |
download | rpg-69ba640bb6c63d2132ca401588053dfc507dbb1b.tar.gz rpg-69ba640bb6c63d2132ca401588053dfc507dbb1b.tar.bz2 |
Save metadata only when really changed
This avoids disk writes when not needed and possibly also xhtml
rendering when the metadata needs to be rendered but xhtml doesn't
(unless the metadata file is changed).
Diffstat (limited to 'inc/parserutils.php')
-rw-r--r-- | inc/parserutils.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php index d4f55a6e4..fbdc2e3a9 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -240,8 +240,10 @@ function p_get_metadata($id, $key='', $render=false){ $cachefile = new cache_renderer($id, wikiFN($id), 'metadata'); if (page_exists($id) && !$cachefile->useCache()){ + $old_meta = $meta; $meta = p_render_metadata($id, $meta); - if (p_save_metadata($id, $meta)) { + // only update the file when the metadata has been changed + if ($meta == $old_meta || p_save_metadata($id, $meta)) { // store a timestamp in order to make sure that the cachefile is touched $cachefile->storeCache(time()); } else { |