From: x2001corpet Date: Sun, 4 Jun 2006 16:07:27 +0000 (+0000) Subject: gestion du cache wiki lors de l'edition de page X-Git-Tag: xorg/0.9.10~78 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=1f334cf241dc7fe8d0996f3964720c31cdb79ee3;p=platal.git gestion du cache wiki lors de l'edition de page git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@291 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/ChangeLog b/ChangeLog index 06046a4..c0089c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,9 @@ Bug/Wish : * Search : - #412: Error SQL in big referent searches. -Car + * Wiki : + - #403: Cache is cleared when editing a page. -Car + From 0.9.8 Branch : * Xnet : diff --git a/htdocs/wiki.php b/htdocs/wiki.php index 7c5ee5b..26a3342 100644 --- a/htdocs/wiki.php +++ b/htdocs/wiki.php @@ -60,7 +60,8 @@ if ($globals->wiki->wikidir) { $_REQUEST['n'] = $n; $dir_wiki_tmp = '../spool/wiki.d/'; - $short_tpl = $dir_wiki_tmp.'cache_'.$n.'.tpl'; + $tpl_name = 'cache_'.$n.'.tpl'; + $short_tpl = $dir_wiki_tmp.$tpl_name; $dir_tpl = $globals->spoolroot.'templates/'.$dir_wiki_tmp; $tpl = $globals->spoolroot.'templates/'.$short_tpl; $tmpfile_exists = file_exists($tpl); @@ -68,6 +69,14 @@ if ($globals->wiki->wikidir) { // don't recreate the tpl if it already exists if (Env::get('action') || !$tmpfile_exists) { + if ($tmpfile_exists) { + unlink($tpl); + $templates_cache_dir = '../spool/templates_c/'; + $dh = opendir($templates_cache_dir); + while (false !== ($filename = readdir($dh))) if (strpos($filename, $tpl_name) !== false) + unlink($templates_cache_dir.$filename); + } + // we leave pmwiki do whatever it wants and store everything ob_start(); require_once(dirname(dirname(__FILE__)).'/'.$globals->wiki->wikidir.'/pmwiki.php'); @@ -99,14 +108,12 @@ if ($globals->wiki->wikidir) { fputs($f, substr($wikiAll, $j)); fclose($f); new_skinned_page($tmp_tpl, AUTH_PUBLIC); - if ($tmpfile_exists) - unlink($tpl); } else { if (!$tmpfile_exists) { $f = fopen($tpl, 'w'); - fputs($f, substr($wikiAll, $j)); - fclose($f); + fputs($f, substr($wikiAll, $j)); + fclose($f); } new_skinned_page($short_tpl, AUTH_PUBLIC); }