DokuWikiにAccess Counterを追加してみる。
追加したのはviewcounter。
$ diff -c inc/template.php.orig inc/template.php
*** inc/template.php.orig Sat Feb 7 14:15:51 2009
--- inc/template.php Sat Feb 7 14:18:46 2009
***************
*** 927,932 ****
--- 927,935 ----
global $INFO;
global $REV;
global $ID;
+ /* for access counter */
+ global $ACT;
+ /* ------------------ */
// return if we are not allowed to view the page
if (!auth_quickaclcheck($ID)) { return false; }
***************
*** 940,945 ****
--- 943,963 ----
$fn = str_replace(fullpath($conf['datadir']).'/','',$fn);
}
}
+ /* for access counter */
+ $ID_fn = str_replace(':', '_', $ID);
+ $fp_views=fopen(realpath($conf['datadir'])."/_cache/$ID_fn.visits",'a+');
+ if ($fp_views) {
+ fscanf($fp_views,"%i",$views);
+ if (($ACT == 'show') && ($INFO['exists'])) {
+ $views++;
+ ftruncate($fp_views,0);
+ fseek($fp_views, 0);
+ fwrite($fp_views,$views);
+ }
+ $fn.=" ($views views) ";
+ fclose($fp_views);
+ }
+ /* ------------------ */
$fn = utf8_decodeFN($fn);
$date = strftime($conf['dformat'],$INFO['lastmod']);
試してみたけど、どんだけ目立たないんだ、これ。
これじゃ全然駄目だなぁ。少し考えないといけない。