use strict; use File::stat; use Sys::Hostname; use POSIX qw(strftime); local our (%kname, %server); # italist.pl local our ($remake, $magic, $DATAREA, $chanHome, $chanName, $ssvv); ############################################################################## sub Pool { my $ike = $_[0] ; if($ike =~ /tr$/) {return 0;} require '../test/asokin/italist.pl' ; &readItaList ; print "

START($ike)------------>
\n" ; $remake = 0 ; $magic = 1000 ; $DATAREA = '../../_datArea' ; print "DATAREA = $DATAREA
\n\n" ; $chanHome = 'http://www.2ch.net/' ; $chanName = '2ちゃんねる' ; $ssvv = (split(/\./, $ENV{SERVER_NAME} || $server{$ike} || hostname))[0]; if(&Pool3Kako($ike)) {&Kakolist3($ike) ;} print "<------- end\n" ; } ############################################################################## sub Pool3Kako { my $itaName = $_[0] ; my $folder = "$DATAREA/$itaName/pool/" ; print "Pool3Kako($folder)
\n" ; if($itaName =~ /tr$/) {return 0;} my @dirs ; if(opendir(DIR, $folder)) { @dirs = grep(!/^\./ && -f "$folder$_" && /\.dat$/, readdir(DIR)); closedir DIR ; } my $fileNum = @dirs ; print "FILE数 = $fileNum ($remake)
\n" ; if(!$remake && !$fileNum) {return 0;} my $ccc = 0 ; foreach(@dirs) { my $xxx = $_ ; $xxx =~ s/\.dat$//i ; if($ccc >= $magic) {last;} if(int($xxx) < 1000000000) {next;} my $moveto = "$DATAREA/$itaName/oyster/" ; mkdir($moveto, 0777) ; chmod(0777, $moveto) ; my $bangof0 = substr($xxx,0,4) ; $moveto = "$DATAREA/$itaName/oyster/$bangof0/" ; mkdir($moveto, 0777) ; chmod(0777, $moveto) ; my $cmdx1 = "$folder$xxx.dat" ; my $cmdx2 = "$moveto$xxx.dat" ; if(-e $cmdx2) {next;} # print "cmdx1=$cmdx1\n" ; # print "cmdx2=$cmdx2\n" ; rename($cmdx1,$cmdx2) ; $ccc ++ ; } return 1; } ############################################################################## sub Kakolist3 { my $itaname = $_[0] ; my $folder = "$DATAREA/$itaname/oyster/" ; my $indexfile = "../$itaname/kako/index.html" ; my $subjectxt = "../$itaname/kako/subject.txt" ; print "Kakolist3($itaname)
\n" ; my @sdirs ; if(opendir(DIR, $folder)) { @sdirs = sort { $b cmp $a; } grep(!/^\./ && -d "$folder$_" && /.../ && /^1/, readdir(DIR)); closedir DIR ; } foreach my $ttt (@sdirs) { my $subd = 0 ; my $infofile = "../$itaname/kako/o$ttt/info.txt"; if(open(PINFOFILE, $infofile)) { my $infoA = ; close(PINFOFILE); chomp($infoA) ; (undef,undef,undef,$subd,undef) = split(/\t/,$infoA); } &html_ctrl($itaname,$ttt,$subd); } local *PINDEXFILE ; open(PSUBJECTT,'>',$subjectxt) ; open(PINDEXFILE,'>',$indexfile) ; &html_head($itaname) ; foreach my $ttt (@sdirs) { my ($subd, $subs); my $infofile = "../$itaname/kako/o$ttt/info.txt"; if(open(PINFOFILE, $infofile)) { my $infoA = ; close(PINFOFILE); chomp($infoA) ; (undef,undef,undef,$subd,$subs) = split(/\t/,$infoA); print PINDEXFILE<#$itaname$ttt$subd$subssubject.txt EOF print PSUBJECTT "o$ttt<>$ttt ($subd)\n"; } } &html_foot ; close(PINDEXFILE) ; close(PSUBJECTT) ; } ############################################################################## sub html_ctrl { my $bbs = $_[0] ; my $numx0 = &getDatNum($bbs,$_[1]) ; my $numx1 = $_[2] ; if(!$remake && $numx1 == $numx0) {return;} print "sate $_[1] $numx1/$numx0\n"; mkdir("../$bbs/kako/o$_[1]",0777); chmod(0777,"../$bbs/kako/o$_[1]"); &Kakohtml3($bbs,$_[1]) ; } ############################################################################## sub Kakohtml3 { my ($itaname, $sokonum) = @_ ; my $sx = substr($sokonum,0,4) ; my $folder = "$DATAREA/$itaname/oyster/$sx/" ; my $pfolder = "../$itaname/kako/o$sx/" ; my $infofile = "../$itaname/kako/o$sx/info.txt" ; my $indexfile = $pfolder . 'index.html' ; my $subjecttxt = $pfolder . 'subject.txt' ; print "Kakohtml3 $itaname ($sokonum)
\n" ; mkdir($pfolder, 0777) ; chmod(0777, $pfolder) ; my @junban ; if(opendir(DIR, $folder)) { @junban = sort { $b cmp $a; } grep(!/^\./ && -f "$folder$_", readdir(DIR)); closedir DIR ; } my %threTitle ; if(open(YSUBJECTT, $subjecttxt)) { local $_; while() { my ($tNo,$tTitle) = split(/<>/) ; $tNo =~ s/\.dat$//i ; chomp($tTitle) ; #print "$tNo,$tTitle
\n"; $threTitle{$tNo} = $tTitle ; } close(YSUBJECTT) ; } my $ttlt = 0; local (*MSUBJECTT, *MINDEXFILE) ; open(MSUBJECTT,'>',$subjecttxt) ; if(open(MINDEXFILE,'>',$indexfile)) { &html_index_head($itaname) ; foreach(@junban) { my $xxx = $_ ; $xxx =~ s/\.dat$//i ; #print "$_ $threTitle{$xxx}\n"; if(!defined $threTitle{$xxx}) { &html_index_body($folder,$xxx,$itaname) ; } else { print MINDEXFILE "$xxx $threTitle{$xxx}
\n"; print MSUBJECTT "$xxx.dat<>$threTitle{$xxx}\n"; } $ttlt ++ ; } &html_index_foot($itaname,$sokonum,$infofile,$ttlt) ; close(MINDEXFILE) ; } close(MSUBJECTT) ; } ############################################################################## sub html_index_body { my ($folder, $datno, $itaname) = @_ ; my $threadfile = "$folder$datno.dat" ; my @logdat = '' ; if(open(THREAD, $threadfile)) { @logdat=; #ログを配列に読み込む close(THREAD) ; } #1つ目の要素を読み込む my $firstlog = $logdat[0]; #改行カット chomp($firstlog); #1つ目の要素を加工する my ($name,$mail,$time,$message,$subject) = split(/<>/,$firstlog); my $typeSign = '※'; my $acho = '-' ; if(!$time) { $firstlog =~ /([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)$/; ($name,$mail,$time,$message,$subject) = ($1,$2,$3,$4,$5); $typeSign = ' '; $acho = '*' ; } if($acho eq '-') { $mail =~ s/ //gi; # $message =~ s/&/&/gi; $message =~ s/&(?!;)/&/g; $message =~ s/(https?|ftp|gopher|telnet|whois|news)\:([\w|\:\!\#\$\%\=\&\-\^\`\\\|\@\~\[\{\]\}\;\+\*\,\.\?\/]+)/$1\:$2<\/a>/ig; } else { $name =~ s/@`/,/gi; $mail =~ s/@`/,/gi; $subject =~ s/@`/,/gi; $message =~ s/@`/,/gi; $message =~ s/&/&/gi; $message =~ s/(https?|ftp|gopher|telnet|whois|news)\:([\w|\:\!\#\$\%\=\&\-\^\`\\\|\@\~\[\{\]\}\;\+\*\,\.\?\/]+)/$1\:$2<\/a>/ig; } $message =~ s/blank">/blank">/gi; my $resnum=@logdat; #print "$datno.dat<> ($resnum)\n"; print MINDEXFILE "$datno $subject ($resnum)
"; print MSUBJECTT "$datno.dat<>$subject ($resnum)\n"; $acho = '#'; } ############################################################################## sub html_index_head { my $itaname = $_[0] ; print MINDEXFILE< $chanName 過去ログ倉庫 ■掲示板に戻る■ ■過去ログ倉庫めにゅーに戻る■

※新しいデータ形式(teriのタイプ)のスレッド

EOF } ############################################################################## sub html_index_foot { my ($itaname, $sokonum, $infofile, $ttlt) = @_; my $sss = $sokonum ; my $sss0 = $sss . '000000'; my $sss9 = $sss . '999999'; my $NOWTIME = time; if($sss9 > $NOWTIME){$sss9 = $NOWTIME;} my $kikan = int($sss9) - int($sss0); $kikan /= 60;#分 $kikan /= 60;#時間 $kikan /= 24;#日 my $speed = sprintf('%5.02f',$ttlt/$kikan) ; if(open(INFOFILE, '>', $infofile)) { print INFOFILE "$ssvv\t$itaname\t$sss\t$ttlt\t$speed\n"; close(INFOFILE); } print MINDEXFILE<


スレッド数 = $ttlt
スレッド立てスピード = $speed / day
問題等、なんかあったら倉庫番 ★へお願いします。 EOF } ############################################################################## sub html_head { my $itaname = $_[0] ; my $itakname = $kname{$itaname} ; print PINDEXFILE< $chanName 過去ログ倉庫 $itakname 板

$chanName 過去ログ倉庫

$itakname 板

$chanName に戻る。

過去ログ倉庫めにゅー に戻る。($ssvvサーバ)

$itakname@$chanName に戻る。

subject.txt EOF } ############################################################################## sub html_foot { print PINDEXFILE< 倉庫番号 旧倉庫。No2
倉庫番号 999999999 以前


問題等、なんかあったら倉庫番 ★へお願いします。 EOF } ############################################################################## sub getLastUpdateP { local $_ = stat($_[0]) ; my @flt = localtime($_ ? $_->mtime : 0) ; return { xupdate => strftime('%Y%m%d%H%M%S', @flt), lupdate => strftime('%Y/%m/%d %T', @flt) }; } ############################################################################## sub getDatNum { my $bbx = $_[0] ; my $datnum = 0 ; my $folder = "$DATAREA/$bbx/oyster/$_[1]/" ; if(!opendir(DIR, $folder)) {return 0;} my @dirs = grep(!/^\./ && -f "$folder$_", readdir(DIR)); closedir DIR ; foreach my $ccccc (@dirs) { if($ccccc ne 'index.html' && $ccccc =~ /\.dat$/) {$datnum ++;} } return $datnum ; } ############################################################################## 1;
倉庫番号スレッド数スピード.txt