;
fclose(BOARDFILE);
my $totalthreads = @threads;
my ($boardname) = split /\|/xsm, $board{ $boards[$j] }, 2;
$yymain .=
qq~
$removemess_txt{'3'} $boardname ($totalthreads $removemess_txt{'6'})
~;
next if !$totalthreads;
my @temparray_1 = ();
my $tempcount = 0;
for my $i ( 0 .. ( $totalthreads - 1 ) ) {
(
$num, undef, undef, undef, $date1,
undef, undef, undef, $status
) = split /\|/xsm, $threads[$i];
$date1 = sprintf '%010d', $date1;
if ( $i < $INFO{'nextthread'} ) {
push @temparray_1, "$date1|$threads[$i]";
next;
}
# Check if original thread was sticky
if ( $keep_sticky && $status =~ /s/ism ) {
push @temparray_1, "$date1|$threads[$i]";
$yymain .= "$num : $removemess_txt{'4'}
";
}
else {
calcdifference();
if ( $result <= $maxdays ) { # If the message is not too old
push @temparray_1, "$date1|$threads[$i]";
$yymain .=
"$num = $result $removemess_txt{'122'}
";
}
else {
# remove thread files
unlink "$datadir/$num.txt";
unlink "$datadir/$num.ctb";
unlink "$datadir/$num.mail";
unlink "$datadir/$num.poll";
unlink "$datadir/$num.polled";
# delete all attachments of removed topic later
$attachfile{$num} = undef;
$tempcount++;
$yymain .=
"$num = $result $removemess_txt{'122'} ($removemess_txt{'123'})
$num : $removemess_txt{'7'}
";
}
}
if ( time() > $time_to_jump && ( $i + 1 ) < $totalthreads ) {
$i++;
for my $x ( $i .. ( $totalthreads - 1 ) ) {
( undef, undef, undef, undef, $date1, undef ) =
split /\|/xsm, $threads[$x], 6;
$date1 = sprintf '%010d', $date1;
push @temparray_1, "$date1|$threads[$x]";
}
fopen( BOARDFILE, ">$boardsdir/$boards[$j].txt", 1 )
|| fatal_error( 'cannot_open',
"$boardsdir/$boards[$j].txt", 1 );
print {BOARDFILE} map( {
s/^.*?\|//xsm;
$_;
} reverse sort { lc($a) cmp lc $b } @temparray_1 )
or croak "$croak{'print'} BOARDFILE";
fclose(BOARDFILE);
# remove attachments of removed topics
RemoveAttachments( \%attachfile );
$i -= $tempcount;
$INFO{'total_rem_count'} += $tempcount;
RemoveOldThreadsText( $j, $i, $INFO{'total_rem_count'} );
}
}
fopen( BOARDFILE, ">$boardsdir/$boards[$j].txt", 1 )
|| fatal_error( 'cannot_open', "$boardsdir/$boards[$j].txt",
1 );
print {BOARDFILE} map( {
s/^.*?\|//xsm;
$_;
} reverse sort { lc($a) cmp lc $b } @temparray_1 )
or croak "$croak{'print'} BOARDFILE";
fclose(BOARDFILE);
BoardCountTotals( $boards[$j] );
$INFO{'total_rem_count'} += $tempcount;
$INFO{'nextthread'} = 0;
}
}
# remove attachments of removed topics
RemoveAttachments( \%attachfile );
automaintenance('off');
$yymain .=
qq~
$removemess_txt{'5'} $INFO{'total_rem_count'} $removemess_txt{'6'}.~;
AdminTemplate();
return;
}
sub RemoveOldThreadsText {
my ( $j, $i, $total ) = @_;
$INFO{'st'} =
int( $INFO{'st'} + time() - $time_to_jump + $max_process_time );
my $query;
foreach ( keys %FORM ) {
if ( $_ =~ /check$/xsm ) { $query .= qq~;$_=$FORM{$_}~; }
}
foreach ( keys %INFO ) {
if ( $_ =~ /check$/xsm ) { $query .= qq~;$_=$INFO{$_}~; }
}
$yymain =
qq~$removemess_txt{'200'} $max_process_time $admin_txt{'533'}.
$removemess_txt{'201'} ~
. ( time() - $time_to_jump + $max_process_time )
. qq~ $admin_txt{'533'}.
$removemess_txt{'202'} ~
. int( ( $INFO{'st'} + 60 ) / 60 ) . qq~ $admin_txt{'537'}.
$total $removemess_txt{'203'}.
$removemess_txt{'210'} $removemess_txt{'211'}...
$removemess_txt{'212'}
$yymain
~;
AdminTemplate();
return;
}
1;