OSDN Git Service

BugTrack/491 RecentDeleted
authorarino <arino>
Wed, 3 Dec 2003 12:40:35 +0000 (21:40 +0900)
committerarino <arino>
Wed, 3 Dec 2003 12:40:35 +0000 (21:40 +0900)
file.php
pukiwiki.ini.php

index e2a420f..efe6e3b 100644 (file)
--- a/file.php
+++ b/file.php
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: file.php,v 1.37 2003/11/05 10:58:39 arino Exp $
+// $Id: file.php,v 1.38 2003/12/03 12:40:35 arino Exp $
 //
 
 // ¥½¡¼¥¹¤ò¼èÆÀ
@@ -112,6 +112,7 @@ function file_write($dir,$page,$str,$notimestamp=FALSE)
        if ($dir == DATA_DIR and $str == '' and file_exists($file))
        {
                unlink($file);
+               put_recentdeleted($page);
        }
        if ($str != '')
        {
@@ -165,6 +166,39 @@ function file_write($dir,$page,$str,$notimestamp=FALSE)
                mb_send_mail($notify_to,$subject,$str,$notify_header);
        }
 }
+// ºï½üÍúÎò¥Ú¡¼¥¸¤Î¹¹¿·
+function put_recentdeleted($page)
+{
+       global $whatsdeleted,$maxshow_deleted;
+       
+       if ($maxshow_deleted == 0)
+       {
+               return;
+       }
+       // update RecentDeleted
+       $lines = array();
+       foreach (get_source($whatsdeleted) as $line)
+       {
+               if (preg_match('/^-(.+) - (\[\[.+\]\])$/',$line,$matches))
+               {
+                       $lines[$matches[2]] = $line;
+               }
+       }
+       $_page = "[[$page]]";
+       if (array_key_exists($_page,$lines))
+       {
+               unset($lines[$_page]);
+       }
+       array_unshift($lines,'-'.format_date(UTIME)." - $_page\n");
+       $lines = array_splice($lines,0,$maxshow_deleted);
+       $fp = fopen(get_filename($whatsdeleted),'w')
+               or die_message('cannot write page file '.htmlspecialchars($whatsdeleted).'<br />maybe permission is not writable or filename is too long');
+       flock($fp,LOCK_EX);
+       fputs($fp,join('',$lines));
+       fputs($fp,"#norelated\n"); // :)
+       flock($fp,LOCK_UN);
+       fclose($fp);
+}
 
 // ºÇ½ª¹¹¿·¥Ú¡¼¥¸¤Î¹¹¿·
 function put_lastmodified()
index 768d4f3..ff5809e 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: pukiwiki.ini.php,v 1.52 2003/12/03 12:17:26 arino Exp $
+// $Id: pukiwiki.ini.php,v 1.53 2003/12/03 12:40:35 arino Exp $
 //
 // PukiWiki setting file
 
@@ -49,6 +49,9 @@ $defaultpage = 'FrontPage';
 // ¹¹¿·ÍúÎò¥Ú¡¼¥¸¤Î̾Á°
 $whatsnew = 'RecentChanges';
 /////////////////////////////////////////////////
+// ºï½üÍúÎò¥Ú¡¼¥¸¤Î̾Á°
+$whatsdeleted = 'RecentDeleted';
+/////////////////////////////////////////////////
 // InterWikiName¥Ú¡¼¥¸¤Î̾Á°
 $interwiki = 'InterWikiName';
 /////////////////////////////////////////////////
@@ -157,8 +160,11 @@ $search_auth = 0;
 // ¹¹¿·ÍúÎò¤òɽ¼¨¤¹¤ë¤È¤­¤ÎºÇÂç·ï¿ô
 $maxshow = 80;
 /////////////////////////////////////////////////
+// ºï½üÍúÎò¤ÎºÇÂç·ï¿ô(0¤Çµ­Ï¿¤·¤Ê¤¤)
+$maxshow_deleted = 0;
+/////////////////////////////////////////////////
 // ÊÔ½¸¤¹¤ë¤³¤È¤Î¤Ç¤­¤Ê¤¤¥Ú¡¼¥¸¤Î̾Á° , ¤Ç¶èÀÚ¤ë
-$cantedit = array( $whatsnew, );
+$cantedit = array( $whatsnew,$whatsdeleted );
 
 /////////////////////////////////////////////////
 // Last-Modified ¥Ø¥Ã¥À¤ò½ÐÎϤ¹¤ë