Top/PukiWiki/改造/新規作成時最新の〜に載せない

新規作成時最新の〜に載せないはてなブックマーク

問題

書きかけのページなど、新規作成時でも「最新の〜件」に載せたくない場合がある。

動作

ページを新規作成する際に「タイムスタンプを変更しない」をチェックすると、
作成日が 2000-01-01 になり、
その結果、「最新の〜件」に載らなくなります。

パッチ (PukiWiki1.4.6)

--- lib/file.php.orig	2005-10-04 22:41:03.000000000 +0900
+++ lib/file.php	2005-07-29 02:50:56.000000000 +0900
@@ -171,8 +171,14 @@
 		// File replacement (Edit)
 		$str = rtrim(preg_replace('/' . "\r" . '/', '', $str)) . "\n";
 
-		if ($notimestamp && file_exists($file))
-			$timestamp = filemtime($file) - LOCALZONE;
+		if ($notimestamp) {
+			if (file_exists($file)) {
+				$timestamp = filemtime($file) - LOCALZONE;
+			} else {
+				// 新規作成時最新の〜に載せない
+				$timestamp = mktime(0,0,0,1,1,2000) - LOCALZONE;
+			}
+ 		}
 
 		$fp = fopen($file, 'a') or die('fopen() failed: ' .
 			htmlspecialchars(basename($dir) . '/' . encode($page) . '.txt') .	

パッチ (PukiWiki1.4.4)

--- lib/file.php.orig	2004-08-01 23:23:20.000000000 +0900
+++ lib/file.php	2004-10-26 22:02:53.000000000 +0900
@@ -115,8 +115,12 @@
 		$str = preg_replace("/\r/", '', $str);
 		$str = rtrim($str) . "\n";
 
-		if ($notimestamp and file_exists($file)) {
-			$timestamp = filemtime($file) - LOCALZONE;
+		if ($notimestamp) {
+			if (file_exists($file)) {
+				$timestamp = filemtime($file) - LOCALZONE;
+			} else {
+				$timestamp = gmmktime(0,0,0,1,1,2000) - LOCALZONE;
+			}
 		}
 
 		$fp = fopen($file, 'w') or

Amazon

差分 一覧