<?php
// PukiWiki - Yet another WikiWikiWeb clone.
-// $Id: file.php,v 1.64 2006/04/25 13:51:56 henoheno Exp $
+// $Id: file.php,v 1.65 2006/04/29 02:32:49 henoheno Exp $
// Copyright (C)
// 2002-2006 PukiWiki Developers Team
// 2001-2002 Originally written by yu-ji
{
global $maxshow, $whatsnew, $autolink;
- $file = CACHE_DIR . PKWK_MAXSHOW_CACHE;
- if ($autolink || ! file_exists($file)) {
+ // AutoLink implimentation needs everything, for now
+ if ($autolink) {
put_lastmodified(); // Try to (re)create ALL
return;
- } else if (check_non_list($page)) {
+ }
+
+ if (check_non_list($page)) return; // No need
+
+ $file = CACHE_DIR . PKWK_MAXSHOW_CACHE;
+ if (! file_exists($file)) {
+ put_lastmodified(); // Try to (re)create ALL
return;
}
set_file_buffer($fp, 0);
flock($fp, LOCK_EX);
- // Read
+ // Read (keep the order of the lines)
$recent_pages = $matches = array();
foreach(file_head($file, $maxshow + PKWK_MAXSHOW_ALLOWANCE, FALSE) as $line)
if (preg_match('/^([0-9]+)\t(.+)/', $line, $matches))
$recent_pages[$matches[2]] = $matches[1];
- // Remove if exists
+ // Remove if it exists inside
if (isset($recent_pages[$page])) unset($recent_pages[$page]);
- // Add: array_unshift()
+ // Add to the top: like array_unshift()
$recent_pages = array($page => get_filetime($page)) + $recent_pages;
// Write
set_file_buffer($fp, 0);
flock($fp, LOCK_EX);
- // Write
+ // Recreate
ftruncate($fp, 0);
rewind($fp);
foreach ($recent_pages as $_page=>$time)