OSDN Git Service

BugTrack-wiki/353 : 番号付きリスト項目リストの組合せが正しく表示されない
[fswiki/fswiki.git] / plugin / attach / AttachDelete.pm
1 ############################################################
2 #
3 # ¥Ú¡¼¥¸¤¬ºï½ü¤µ¤ì¤¿¤È¤­¤Î¥Õ¥Ã¥¯
4 #
5 ############################################################
6 package plugin::attach::AttachDelete;
7 use strict;
8 #===========================================================
9 # ¥³¥ó¥¹¥È¥é¥¯¥¿
10 #===========================================================
11 sub new {
12         my $class = shift;
13         my $self = {};
14         return bless $self,$class;
15 }
16 #===========================================================
17 # ¥Ú¡¼¥¸ºï½ü»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¥Õ¥Ã¥¯´Ø¿ô
18 #===========================================================
19 sub hook {
20         my $self = shift;
21         my $wiki = shift;
22         my $cgi = $wiki->get_CGI;
23         my $pagename = $cgi->param("page");
24         my $encode_page = &Util::url_encode($pagename);
25         
26         opendir(DIR,$wiki->config('attach_dir')) or die $!;
27         while(my $entry = readdir(DIR)){
28                 if(index($entry,$encode_page.".")==0){
29                         unlink($wiki->config('attach_dir')."/$entry");
30                 }
31         }
32         closedir(DIR);
33 }
34
35 1;