From 69ba640bb6c63d2132ca401588053dfc507dbb1b Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Mon, 27 Dec 2010 22:51:06 +0100 Subject: 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). --- inc/parserutils.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'inc/parserutils.php') 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 { -- cgit v1.2.3