]>
git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - html/cgi-bin/updatexlrator.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
30 require '/var/ipfire/general-functions.pl';
31 require "${General::swroot}/lang.pl";
32 require "${General::swroot}/header.pl";
40 my %xlratorsettings=();
67 my $repository = "/var/updatecache/";
68 my $hintcolour = '#FFFFCC';
69 my $colourgray = '#808080';
76 my $not_accessed_last='';
80 my @repositorylist=();
81 my @repositoryfiles=();
85 my $chk_cron_dly = "${General::swroot}/updatexlrator/autocheck/cron.daily";
86 my $chk_cron_wly = "${General::swroot}/updatexlrator/autocheck/cron.weekly";
87 my $chk_cron_mly = "${General::swroot}/updatexlrator/autocheck/cron.monthly";
89 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
90 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
91 &General
::readhash
("${General::swroot}/proxy/settings", \
%proxysettings);
92 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
94 $xlratorsettings{'ACTION'} = '';
95 $xlratorsettings{'ENABLE_LOG'} = 'off';
96 $xlratorsettings{'PASSIVE_MODE'} = 'off';
97 $xlratorsettings{'MAX_DISK_USAGE'} = '75';
98 $xlratorsettings{'LOW_DOWNLOAD_PRIORITY'} = 'off';
99 $xlratorsettings{'MAX_DOWNLOAD_RATE'} = '';
100 $xlratorsettings{'ENABLE_AUTOCHECK'} = 'off';
101 $xlratorsettings{'FULL_AUTOSYNC'} = 'off';
102 $xlratorsettings{'NOT_ACCESSED_LAST'} = 'month1';
104 &Header
::getcgihash
(\
%xlratorsettings);
106 $xlratorsettings{'EXTENDED_GUI'} = '';
108 if ($xlratorsettings{'ACTION'} eq "$Lang::tr{'updxlrtr statistics'} >>")
110 $xlratorsettings{'EXTENDED_GUI'} = 'statistics';
113 if ($xlratorsettings{'ACTION'} eq "$Lang::tr{'updxlrtr maintenance'} >>")
115 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
118 if ($xlratorsettings{'ACTION'} eq $Lang::tr
{'updxlrtr purge'})
120 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
122 if (($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on') || ($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') || ($xlratorsettings{'REMOVE_OUTDATED'} eq 'on'))
125 undef @repositoryfiles;
126 foreach (<$repository/*>)
130 unless (/^$repository\/download
$/) { push(@sources,$_); }
137 $vendorid = substr($_,rindex($_,"/")+1);
140 $uuid = substr($_,rindex($_,"/")+1);
141 if (-e
"$_/source.url")
143 open (FILE
,"$_/source.url");
147 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
148 $updatefile = "$vendorid/$uuid/$updatefile";
149 push(@repositoryfiles,$updatefile);
154 foreach (@repositoryfiles)
156 ($vendorid,$uuid,$updatefile) = split('/');
158 if (-e
"$repository/$vendorid/$uuid/status")
160 open (FILE
,"$repository/$vendorid/$uuid/status");
164 $status = $metadata[-1];
167 if (-e
"$repository/$vendorid/$uuid/access.log")
169 open (FILE
,"$repository/$vendorid/$uuid/access.log");
173 $lastaccess = $metadata[-1];
176 if (($xlratorsettings{'REMOVE_NOSOURCE'} eq 'on') && ($status == $sfNoSource))
178 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
180 if (($xlratorsettings{'REMOVE_OUTDATED'} eq 'on') && ($status == $sfOutdated))
182 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
184 if ($xlratorsettings{'REMOVE_OBSOLETE'} eq 'on')
186 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'week') && ($lastaccess < (time - 604800)))
188 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
190 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month1') && ($lastaccess < (time - 2505600)))
192 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
194 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month3') && ($lastaccess < (time - 7516800)))
196 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
198 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'month6') && ($lastaccess < (time - 15033600)))
200 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
202 if (($xlratorsettings{'NOT_ACCESSED_LAST'} eq 'year') && ($lastaccess < (time - 31536000)))
204 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
211 if ($xlratorsettings{'ACTION'} eq $Lang::tr
{'save'})
213 if (!($xlratorsettings{'MAX_DISK_USAGE'} =~ /^\d+$/) || ($xlratorsettings{'MAX_DISK_USAGE'} < 1) || ($xlratorsettings{'MAX_DISK_USAGE'} > 100))
215 $errormessage = $Lang::tr
{'updxlrtr invalid disk usage'};
218 if (($xlratorsettings{'MAX_DOWNLOAD_RATE'} ne '') && ((!($xlratorsettings{'MAX_DOWNLOAD_RATE'} =~ /^\d+$/)) || ($xlratorsettings{'MAX_DOWNLOAD_RATE'} < 1)))
220 $errormessage = $Lang::tr
{'updxlrtr invalid download rate'};
227 if ($xlratorsettings{'ACTION'} eq $Lang::tr
{'updxlrtr save and restart'})
229 if (!($xlratorsettings{'MAX_DISK_USAGE'} =~ /^\d+$/) || ($xlratorsettings{'MAX_DISK_USAGE'} < 1) || ($xlratorsettings{'MAX_DISK_USAGE'} > 100))
231 $errormessage = $Lang::tr
{'updxlrtr invalid disk usage'};
234 if (($xlratorsettings{'MAX_DOWNLOAD_RATE'} ne '') && ((!($xlratorsettings{'MAX_DOWNLOAD_RATE'} =~ /^\d+$/)) || ($xlratorsettings{'MAX_DOWNLOAD_RATE'} < 1)))
236 $errormessage = $Lang::tr
{'updxlrtr invalid download rate'};
239 if ((!(-e
"${General::swroot}/proxy/enable")) && (!(-e
"${General::swroot}/proxy/enable_blue")))
241 $errormessage = $Lang::tr
{'updxlrtr web proxy service required'};
244 if (!($proxysettings{'ENABLE_UPDXLRATOR'} eq 'on'))
246 $errormessage = $Lang::tr
{'updxlrtr not enabled'};
252 system('/usr/local/bin/squidctrl restart >/dev/null 2>&1');
255 if ($xlratorsettings{'ACTION'} eq $Lang::tr
{'updxlrtr remove file'})
257 $xlratorsettings{'EXTENDED_GUI'} = 'maintenance';
259 $updatefile = $xlratorsettings{'ID'};
261 if ($updatefile =~ /^download\//)
263 ($uuid,$vendorid,$updatefile) = split('/',$updatefile);
264 if (-e
"$repository/download/$vendorid/$updatefile") { system("rm $repository/download/$vendorid/$updatefile"); }
266 ($vendorid,$uuid,$updatefile) = split('/',$updatefile);
267 if (-e
"$repository/$vendorid/$uuid/$updatefile") { system("rm -r $repository/$vendorid/$uuid"); }
271 $not_accessed_last = $xlratorsettings{'NOT_ACCESSED_LAST'};
272 undef($xlratorsettings{'NOT_ACCESSED_LAST'});
274 if (-e
"${General::swroot}/updatexlrator/settings") { &General
::readhash
("${General::swroot}/updatexlrator/settings", \
%xlratorsettings); }
276 if ($xlratorsettings{'NOT_ACCESSED_LAST'} eq '') { $xlratorsettings{'NOT_ACCESSED_LAST'} = $not_accessed_last; } ;
280 $checked{'ENABLE_LOG'}{'off'} = '';
281 $checked{'ENABLE_LOG'}{'on'} = '';
282 $checked{'ENABLE_LOG'}{$xlratorsettings{'ENABLE_LOG'}} = "checked='checked'";
283 $checked{'PASSIVE_MODE'}{'off'} = '';
284 $checked{'PASSIVE_MODE'}{'on'} = '';
285 $checked{'PASSIVE_MODE'}{$xlratorsettings{'PASSIVE_MODE'}} = "checked='checked'";
286 $checked{'LOW_DOWNLOAD_PRIORITY'}{'off'} = '';
287 $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} = '';
288 $checked{'LOW_DOWNLOAD_PRIORITY'}{$xlratorsettings{'LOW_DOWNLOAD_PRIORITY'}} = "checked='checked'";
289 $checked{'ENABLE_AUTOCHECK'}{'off'} = '';
290 $checked{'ENABLE_AUTOCHECK'}{'on'} = '';
291 $checked{'ENABLE_AUTOCHECK'}{$xlratorsettings{'ENABLE_AUTOCHECK'}} = "checked='checked'";
292 $checked{'FULL_AUTOSYNC'}{'off'} = '';
293 $checked{'FULL_AUTOSYNC'}{'on'} = '';
294 $checked{'FULL_AUTOSYNC'}{$xlratorsettings{'FULL_AUTOSYNC'}} = "checked='checked'";
296 $selected{'AUTOCHECK_SCHEDULE'}{$xlratorsettings{'AUTOCHECK_SCHEDULE'}} = "selected='selected'";
297 $selected{'NOT_ACCESSED_LAST'}{$xlratorsettings{'NOT_ACCESSED_LAST'}} = "selected='selected'";
299 # ----------------------------------------------------
301 # ----------------------------------------------------
303 &Header
::showhttpheaders
();
305 &Header
::openpage
($Lang::tr
{'updxlrtr configuration'}, 1, '');
307 &Header
::openbigbox
('100%', 'left', '', $errormessage);
310 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
311 print "<font class='base'>$errormessage </font>\n";
315 print "<form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>\n";
317 &Header
::openbox
('100%', 'left', "$Lang::tr{'updxlrtr update accelerator'}");
322 <td colspan='4'><b>$Lang::tr{'updxlrtr common settings'}</b></td>
325 <td class='base' width='25%'>$Lang::tr{'updxlrtr enable log'}:</td>
326 <td class='base' width='20%'><input type='checkbox' name='ENABLE_LOG' $checked{'ENABLE_LOG'}{'on'} /></td>
327 <td class='base' width='25%'></td>
328 <td class='base' width='30%'></td>
331 <td class='base'>$Lang::tr{'updxlrtr passive mode'}:</td>
332 <td class='base'><input type='checkbox' name='PASSIVE_MODE' $checked{'PASSIVE_MODE'}{'on'} /></td>
333 <td class='base'>$Lang::tr{'updxlrtr max disk usage'}:</td>
334 <td class='base'><input type='text' name='MAX_DISK_USAGE' value='$xlratorsettings{'MAX_DISK_USAGE'}' size='1' /> %</td>
340 <td colspan='4'><b>$Lang::tr{'updxlrtr performance options'}</b></td>
343 <td class='base' width='25%'>$Lang::tr{'updxlrtr low download priority'}:</td>
344 <td class='base' width='20%'><input type='checkbox' name='LOW_DOWNLOAD_PRIORITY' $checked{'LOW_DOWNLOAD_PRIORITY'}{'on'} /></td>
345 <td class='base' width='25%'>$Lang::tr{'updxlrtr max download rate'}: <img src='/blob.gif' alt='*' </td>
346 <td class='base' width='30%'><input type='text' name='MAX_DOWNLOAD_RATE' value='$xlratorsettings{'MAX_DOWNLOAD_RATE'}' size='5' /></td>
352 <td colspan='4'><b>$Lang::tr{'updxlrtr source checkup'}</b></td>
355 <td class='base' width='25%'>$Lang::tr{'updxlrtr enable autocheck'}:</td>
356 <td class='base' width='20%'><input type='checkbox' name='ENABLE_AUTOCHECK' $checked{'ENABLE_AUTOCHECK'}{'on'} /></td>
357 <td class='base' width='25%'>$Lang::tr{'updxlrtr source checkup schedule'}:</td>
358 <td class='base' width='30%'>
359 <select name='AUTOCHECK_SCHEDULE'>
360 <option value='daily' $selected{'AUTOCHECK_SCHEDULE'}{'daily'}>$Lang::tr{'updxlrtr daily'}</option>
361 <option value='weekly' $selected{'AUTOCHECK_SCHEDULE'}{'weekly'}>$Lang::tr{'updxlrtr weekly'}</option>
362 <option value='monthly' $selected{'AUTOCHECK_SCHEDULE'}{'monthly'}>$Lang::tr{'updxlrtr monthly'}</option>
367 <td class='base'>$Lang::tr{'updxlrtr full autosync'}:</td>
368 <td class='base'><input type='checkbox' name='FULL_AUTOSYNC' $checked{'FULL_AUTOSYNC'}{'on'} /></td>
376 <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
377 <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr save and restart'}' /></td>
382 print" <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr statistics'}";
383 if ($xlratorsettings{'EXTENDED_GUI'} eq 'statistics') { print " <<' "; } else { print " >>' "; }
386 print" <td align='center' width='20%'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr maintenance'}";
387 if ($xlratorsettings{'EXTENDED_GUI'} eq 'maintenance') { print " <<' "; } else { print " >>' "; }
400 # =====================================================================================
402 # =====================================================================================
404 if ($xlratorsettings{'EXTENDED_GUI'} eq 'statistics')
407 # ----------------------------------------------------
409 # ----------------------------------------------------
412 foreach (<$repository/*>)
416 unless ((/^$repository\/download
$/) || (/^$repository\
/lost\+found$/)) { push(@sources,$_); }
423 $vendorid=substr($_,rindex($_,'/')+1,length($_));
424 push(@vendors,$vendorid);
426 foreach $data (@updatelist)
428 if (-e
"$data/source.url")
430 open (FILE
,"$data/source.url");
434 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
438 $filesize += (-s
"$data/$updatefile");
440 # File size for this source
442 $vendorstats{$vendorid."_filesize"} += (-s
"$data/$updatefile");
444 # Number of requests from cache for this source
446 open (FILE
,"$data/access.log");
452 $vendorstats{$vendorid."_requests"} += $counts;
453 $cachehits += $counts;
455 # Total number of files in cache
459 # Number of files for this source
461 $vendorstats{$vendorid."_files"}++;
463 # Count cache status occurences
465 open (FILE
,"$data/status");
469 $vendorstats{$vendorid."_".$_}++;
471 # Calculate cached traffic for this source
473 $vendorstats{$vendorid."_cachehits"} += $counts * (-s
"$data/$updatefile");
475 # Calculate total cached traffic
477 $cachedtraffic += $counts * (-s
"$data/$updatefile");
483 if ($numfiles) { $efficiency = sprintf("%.1f", $cachehits / $numfiles); }
485 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
486 1 while $cachedtraffic =~ s/^(-?\d+)(\d{3})/$1.$2/;
488 # ----------------------------------------------------
490 # ----------------------------------------------------
492 &Header
::openbox
('100%', 'left', "$Lang::tr{'updxlrtr cache statistics'}");
494 unless ($numfiles) { print "<i>$Lang::tr{'updxlrtr empty repository'}</i>\n<hr size='1'>\n"; }
498 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr disk usage'}</b></td></tr>
500 <table cellpadding='3'>
502 <td align='left' class='base'><i>$Lang::tr{'updxlrtr cache dir'}</i></td>
503 <td align='center' class='base'><i>$Lang::tr{'size'}</i></td>
504 <td align='center' class='base'><i>$Lang::tr{'used'}</i></td>
505 <td align='center' class='base'><i>$Lang::tr{'free'}</i></td>
506 <td align='left' class='base' colspan='2'><i>$Lang::tr{'percentage'}</i></td>
511 open(DF
,"/bin/df -h $repository|");
516 $dfstr = join(' ',@dfdata);
517 my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
521 <td>[$repository]</td>
522 <td align='right'>$size</td>
523 <td align='right'>$used</td>
524 <td align='right'>$free</td>
528 &percentbar
($percent);
531 <td align='right'>$percent</td>
543 <td colspan='5'><b>$Lang::tr{'updxlrtr summary'}</b></td>
546 <td class='base' width='25%'>$Lang::tr{'updxlrtr total files'}:</td>
547 <td class='base' width='20%'><font color='$colourgray'>$numfiles</font></td>
548 <td class='base' width='25%'>$Lang::tr{'updxlrtr total cache size'}:</td>
549 <td class='base' width='15%' align='right'><font color='$colourgray'>$filesize</font></td>
550 <td class='base'></td>
553 <td class='base'>$Lang::tr{'updxlrtr efficiency index'}:</td>
554 <td class='base'><font color='$colourgray'>$efficiency</font></td>
555 <td class='base'>$Lang::tr{'updxlrtr total data from cache'}:</td>
556 <td class='base' align='right'><font color='$colourgray'>$cachedtraffic</font></td>
557 <td class='base'></td>
563 <td colspan='17'><b>$Lang::tr{'updxlrtr statistics by source'}</b></td>
566 <td class='base' colspan='2'><i>$Lang::tr{'updxlrtr source'}</i></td>
567 <td class='base' width='7%'> </td>
568 <td class='base' align='right'><i>$Lang::tr{'updxlrtr files'}</i></td>
569 <td class='base' width='7%'> </td>
570 <td class='base' align='right'><nobr><i>$Lang::tr{'updxlrtr cache size'}</i></nobr></td>
571 <td class='base' width='7%'> </td>
572 <td class='base' align='right'><nobr><i>$Lang::tr{'updxlrtr data from cache'}</i></nobr></td>
573 <td class='base' width='15%'> </td>
574 <td class='base'><img src="/images/updbooster/updxl-led-green.gif" /></td>
575 <td class='base' width='15%'> </td>
576 <td class='base'><img src="/images/updbooster/updxl-led-yellow.gif" /></td>
577 <td class='base' width='15%'> </td>
578 <td class='base'><img src="/images/updbooster/updxl-led-red.gif" /></td>
579 <td class='base' width='15%'> </td>
580 <td class='base'><img src="/images/updbooster/updxl-led-gray.gif" /></td>
581 <td class='base' width='90%'> </td>
592 unless ($vendorstats{$vendorid . "_files"}) { next; }
596 print "<tr bgcolor=''$color{'color20'}'>\n"; }
598 print "<tr bgcolor=''$color{'color22'}'>\n"; }
600 print "<td class='base' align='center'><nobr> ";
602 if ($vendorid =~ /^Adobe$/i)
604 print "<img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe'}' /> </nobr></td>\n";
605 print "<td class='base'> Adobe </td>\n";
606 } elsif ($vendorid =~ /^Microsoft$/i)
608 print "<img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft'}' /> </nobr></td>\n";
609 print "<td class='base'> Microsoft </td>\n";
610 } elsif ($vendorid =~ /^Symantec$/i)
612 print "<img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec'}' /> </nobr></td>\n";
613 print "<td class='base'> Symantec </td>\n";
614 } elsif ($vendorid =~ /^Linux$/i)
616 print "<img src='/images/updbooster/updxl-src-linux.gif' alt='Linux'}' /> </nobr></td>\n";
617 print "<td class='base'> Linux </td>\n";
618 } elsif ($vendorid =~ /^TrendMicro$/i)
620 print "<img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro'}' /> </nobr></td>\n";
621 print "<td class='base'> Trend Micro </td>\n";
622 } elsif ($vendorid =~ /^Apple$/i)
624 print "<img src='/images/updbooster/updxl-src-apple.gif' alt='Apple'}' /> </nobr></td>\n";
625 print "<td class='base'> Apple </td>\n";
626 } elsif ($vendorid =~ /^Avast$/i)
628 print "<img src='/images/updbooster/updxl-src-avast.gif' alt='Avast'}' /> </nobr></td>\n";
629 print "<td class='base'> Avast </td>\n";
630 } elsif ($vendorid =~ /^Avira$/i)
632 print "<img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' /> </td>\n";
633 print "<td class='base'> Avira </td>\n";
634 } elsif ($vendorid =~ /^AVG$/i)
636 print "<img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' /> </td>\n";
637 print "<td class='base'> AVG </td>\n";
638 } elsif ($vendorid =~ /^Ipfire$/i)
640 print "<img src='/images/IPFire.png' width='18' height='18' alt='IPFire' /> </td>\n";
641 print "<td class='base'> IPFiew </td>\n";
644 if (-e
"/srv/web/ipfire/html/images/updbooster/updxl-src-" . $vendorid . ".gif")
646 print "<img src='/images/updbooster/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' /> </nobr></td>\n";
648 print "<img src='/images/updbooster/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' /> </nobr></td>\n";
650 print "<td class='base'> " . ucfirst $vendorid . " </td>\n";
653 print "<td class='base' colspan=2 align='right'>";
654 printf "%5d", $vendorstats{$vendorid."_files"};
655 print " </td>\n";
657 unless ($vendorstats{$vendorid."_filesize"}) { $vendorstats{$vendorid."_filesize"} = '0'; }
658 1 while $vendorstats{$vendorid."_filesize"} =~ s/^(-?\d+)(\d{3})/$1.$2/;
659 print "<td class='base' colspan=2 align='right'>";
660 printf "%15s", $vendorstats{$vendorid."_filesize"};
661 print " </td>\n";
663 unless ($vendorstats{$vendorid."_cachehits"}) { $vendorstats{$vendorid."_cachehits"} = '0'; }
664 1 while $vendorstats{$vendorid."_cachehits"} =~ s/^(-?\d+)(\d{3})/$1.$2/;
665 print "<td class='base' colspan=2 align='right'>";
666 printf "%15s", $vendorstats{$vendorid."_cachehits"};
667 print " </td>\n";
669 print "<td class='base' colspan=2 align='right'>";
670 printf "%5d", $vendorstats{$vendorid."_1"};
671 print " </td>\n";
673 print "<td class='base' colspan=2 align='right'>";
674 printf "%5d", $vendorstats{$vendorid."_3"};
675 print " </td>\n";
677 print "<td class='base' colspan=2 align='right'>";
678 printf "%5d", $vendorstats{$vendorid."_2"};
679 print " </td>\n";
681 print "<td class='base' colspan=2 align='right'>";
682 printf "%5d", $vendorstats{$vendorid."_0"};
683 print " </td>\n";
685 print "<td class='base'> </td>\n";
695 <td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
696 <td class='base'> </td>
697 <td align='center'><img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /></td>
698 <td class='base'>$Lang::tr{'updxlrtr condition ok'}</td>
699 <td class='base'> </td>
700 <td align='center'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
701 <td class='base'>$Lang::tr{'updxlrtr condition nosource'}</td>
702 <td class='base'> </td>
703 <td align='center'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
704 <td class='base'>$Lang::tr{'updxlrtr condition outdated'}</td>
705 <td class='base'> </td>
706 <td align='center'><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /></td>
707 <td class='base'>$Lang::tr{'updxlrtr condition unknown'}</td>
708 <td class='base'> </td>
720 # =====================================================================================
722 # =====================================================================================
724 if ($xlratorsettings{'EXTENDED_GUI'} eq 'maintenance')
728 # ----------------------------------------------------
730 # ----------------------------------------------------
732 &Header
::openbox
('100%', 'left', "$Lang::tr{'updxlrtr cache maintenance'}");
734 @sources= <$repository/download/*>;
736 undef @repositoryfiles;
741 @updatelist = <$_/*>;
742 $vendorid = substr($_,rindex($_,"/")+1);
745 $updatefile = substr($_,rindex($_,"/")+1);
746 $updatefile .= ":download/$vendorid/$updatefile";
747 $updatefile = " ".$updatefile;
748 push(@repositoryfiles,$updatefile);
754 foreach (<$repository/*>)
758 unless (/^$repository\/download
$/) { push(@sources,$_); }
765 $vendorid = substr($_,rindex($_,"/")+1);
768 $uuid = substr($_,rindex($_,"/")+1);
769 if (-e
"$_/source.url")
771 open (FILE
,"$_/source.url");
775 $updatefile = substr($sourceurl,rindex($sourceurl,'/')+1,length($sourceurl));
776 $_ = $updatefile; tr/[A-Z]/[a-z]/;
777 $updatefile = "$_:$vendorid/$uuid/$updatefile";
778 push(@repositoryfiles,$updatefile);
783 @repositoryfiles = sort(@repositoryfiles);
785 unless (@repositoryfiles) { print "<i>$Lang::tr{'updxlrtr empty repository'}</i>\n<hr size='1'>\n"; }
789 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr disk usage'}</b></td></tr>
791 <table cellpadding='3'>
793 <td align='left' class='base'><i>$Lang::tr{'updxlrtr cache dir'}</i></td>
794 <td align='center' class='base'><i>$Lang::tr{'size'}</i></td>
795 <td align='center' class='base'><i>$Lang::tr{'used'}</i></td>
796 <td align='center' class='base'><i>$Lang::tr{'free'}</i></td>
797 <td align='left' class='base' colspan='2'><i>$Lang::tr{'percentage'}</i></td>
802 open(DF
,"/bin/df -h $repository|");
807 $dfstr = join(' ',@dfdata);
808 my ($device,$size,$used,$free,$percent,$mount) = split(' ',$dfstr);
812 <td>[$repository]</td>
813 <td align='right'>$size</td>
814 <td align='right'>$used</td>
815 <td align='right'>$free</td>
819 &percentbar
($percent);
822 <td align='right'>$percent</td>
828 if (@repositoryfiles)
832 <form method='post' action='$ENV{'SCRIPT_NAME'}' enctype='multipart/form-data'>
835 <td class='base' colspan='3'><input type='submit' name='ACTION' value='$Lang::tr{'updxlrtr purge'}' /> $Lang::tr{'updxlrtr all files'}</td>
836 <td class='base' width='25%'><input type='checkbox' name='REMOVE_OBSOLETE' $checked{'REMOVE_OBSOLETE'}{'on'} /> $Lang::tr{'updxlrtr not accessed'}</td>
837 <td class='base' colspan='3'><select name='NOT_ACCESSED_LAST'>
838 <option value='week' $selected{'NOT_ACCESSED_LAST'}{'week'}>$Lang::tr{'updxlrtr week'}</option>
839 <option value='month1' $selected{'NOT_ACCESSED_LAST'}{'month1'}>$Lang::tr{'updxlrtr month'}</option>
840 <option value='month3' $selected{'NOT_ACCESSED_LAST'}{'month3'}>$Lang::tr{'updxlrtr 3 months'}</option>
841 <option value='month6' $selected{'NOT_ACCESSED_LAST'}{'month6'}>$Lang::tr{'updxlrtr 6 months'}</option>
842 <option value='year' $selected{'NOT_ACCESSED_LAST'}{'year'}>$Lang::tr{'updxlrtr year'}</option>
849 <td class='base' width='25%'><input type='checkbox' name='REMOVE_NOSOURCE' $checked{'REMOVE_NOSOURCE'}{'on'} /> $Lang::tr{'updxlrtr marked as'}</td>
850 <td class='base' width='3%'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
851 <td class='base' width='17%'>[<i>$Lang::tr{'updxlrtr condition nosource'}</i>]</td>
852 <td class='base' width='25%'><input type='checkbox' name='REMOVE_OUTDATED' $checked{'REMOVE_OUTDATED'}{'on'} /> $Lang::tr{'updxlrtr marked as'}</td>
853 <td class='base' width='3%'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
854 <td class='base' width='27%'>[<i>$Lang::tr{'updxlrtr condition outdated'}</i>]</td>
860 <tr><td class='boldbase'><b>$Lang::tr{'updxlrtr current files'}</b></td></tr>
863 <colgroup span='2' width='2%'></colgroup>
864 <colgroup span='1' width='0*'></colgroup>
865 <colgroup span='4' width='5%'></colgroup>
866 <colgroup span='1' width='2%'></colgroup>
868 <td class='base' align='center'> </td>
869 <td class='base' align='center'> </td>
870 <td class='base' align='center'><b>$Lang::tr{'updxlrtr filename'}</b></td>
871 <td class='base' align='center'><b>$Lang::tr{'updxlrtr filesize'}</b></td>
872 <td class='base' align='center'><b>$Lang::tr{'date'}</b></td>
873 <td class='base' align='center'><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
874 <td class='base' align='center'><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
875 <td class='base' align='center'> </td>
880 foreach $updatefile (@repositoryfiles)
882 $updatefile =~ s/.*://;
886 print "<tr bgcolor='$Header::table1colour'>\n"; }
888 print "<tr bgcolor='$Header::table2colour'>\n"; }
889 $filesize = (-s
"$repository/$updatefile");
890 1 while $filesize =~ s/^(-?\d+)(\d{3})/$1.$2/;
892 my ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime(&getmtime
("$repository/$updatefile"));
893 $DAYdt = sprintf ("%.02d",$DAYdt);
894 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
895 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
896 $filedate = $YEARdt."-".$MONTHdt."-".$DAYdt;
901 $status = $sfUnknown;
903 unless ($updatefile =~ /^download\//)
905 ($vendorid,$uuid,$shortname) = split('/',$updatefile);
907 if (-e
"$repository/$vendorid/$uuid/access.log")
909 open (FILE
,"$repository/$vendorid/$uuid/access.log");
914 ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[-1]);
915 $DAYdt = sprintf ("%.02d",$DAYdt);
916 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
917 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
918 if (($metadata[-1] =~ /^\d+/) && ($metadata[-1] >= 1)) { $lastaccess = $YEARdt."-".$MONTHdt."-".$DAYdt; }
920 if (-e
"$repository/$vendorid/$uuid/checkup.log")
922 open (FILE
,"$repository/$vendorid/$uuid/checkup.log");
927 ($SECdt,$MINdt,$HOURdt,$DAYdt,$MONTHdt,$YEARdt) = localtime($metadata[-1]);
928 $DAYdt = sprintf ("%.02d",$DAYdt);
929 $MONTHdt = sprintf ("%.02d",$MONTHdt+1);
930 $YEARdt = sprintf ("%.04d",$YEARdt+1900);
931 if (($metadata[-1] =~ /^\d+/) && ($metadata[-1] >= 1)) { $lastcheck = $YEARdt."-".$MONTHdt."-".$DAYdt; }
933 if (-e
"$repository/$vendorid/$uuid/status")
935 open (FILE
,"$repository/$vendorid/$uuid/status");
939 $status = $metadata[-1];
942 ($uuid,$vendorid,$shortname) = split('/',$updatefile);
943 $status = $sfOutdated;
946 print "\t\t<td align='center' nowrap='nowrap'> ";
947 if ($status == $sfUnknown)
949 print "<img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /> </td>\n";
951 if ($status == $sfOk)
953 print "<img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /> </td>\n";
955 if ($status == $sfNoSource)
957 print "<img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /> </td>\n";
959 if (($status == $sfOutdated) && (!($updatefile =~ /^download\//i
)))
961 print "<img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /> </td>\n";
963 if (($status == $sfOutdated) && ($updatefile =~ /^download\//i
))
965 print "<img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /> </td>\n";
968 print "\t\t<td align='center' nowrap='nowrap'> ";
969 if ($vendorid =~ /^Adobe$/i)
971 print "<img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe'}' /> </td>\n";
972 } elsif ($vendorid =~ /^Microsoft$/i)
974 print "<img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft'}' /> </td>\n";
975 } elsif ($vendorid =~ /^Symantec$/i)
977 print "<img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec'}' /> </td>\n";
978 } elsif ($vendorid =~ /^Linux$/i)
980 print "<img src='/images/updbooster/updxl-src-linux.gif' alt='Linux'}' /> </td>\n";
981 } elsif ($vendorid =~ /^TrendMicro$/i)
983 print "<img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro'}' /> </td>\n";
984 } elsif ($vendorid =~ /^Apple$/i)
986 print "<img src='/images/updbooster/updxl-src-apple.gif' alt='Apple'}' /> </td>\n";
987 } elsif ($vendorid =~ /^Avast$/i)
989 print "<img src='/images/updbooster/updxl-src-avast.gif' alt='Avast'}' /> </td>\n";
990 } elsif ($vendorid =~ /^Avira$/i)
992 print "<img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' /> </td>\n";
993 } elsif ($vendorid =~ /^AVG$/i)
995 print "<img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' /> </td>\n";
996 } elsif ($vendorid =~ /^Ipfire$/i)
998 print "<img src='/images/IPFire.png' width='18' height='18' alt='IPFire' /> </td>\n";
1002 if (-e
"/srv/web/ipfire/html/images/updbooster/updxl-src-" . $vendorid . ".gif")
1004 print "<img src='/images/updbooster/updxl-src-" . $vendorid . ".gif' alt='" . ucfirst $vendorid . "' /> </td>\n";
1006 print "<img src='/images/updbooster/updxl-src-unknown.gif' alt='" . ucfirst $vendorid . "' /> </td>\n";
1010 $shortname = substr($updatefile,rindex($updatefile,"/")+1);
1011 $shortname =~ s/(.*)_[\da-f]*(\.(exe|cab|psf)$)/\1_*\2/i;
1014 <td class='base' align='left' title='cache:/$updatefile'><a href="/updatecache/$updatefile">$shortname</a></td>
1015 <td class='base' align='right' nowrap='nowrap'> $filesize </td>
1016 <td class='base' align='center' nowrap='nowrap'> $filedate </td>
1017 <td class='base' align='center' nowrap='nowrap'> $lastaccess </td>
1018 <td class='base' align='center' nowrap='nowrap'> $lastcheck </td>
1020 <form method='post' name='frma$id' action='$ENV{'SCRIPT_NAME'}'>
1021 <input type='image' name='$Lang::tr{'updxlrtr remove file'}' src='/images/delete.gif' title='$Lang::tr{'updxlrtr remove file'}' alt='$Lang::tr{'updxlrtr remove file'}' />
1022 <input type='hidden' name='ID' value='$updatefile' />
1023 <input type='hidden' name='ACTION' value='$Lang::tr{'updxlrtr remove file'}' />
1036 <td class='boldbase'> <b>$Lang::tr{'legend'}:</b></td>
1037 <td class='base'> </td>
1038 <td><img src='/images/reload.gif' alt='$Lang::tr{'updxlrtr last access'}' /></td>
1039 <td class='base'>$Lang::tr{'updxlrtr last access'}</td>
1040 <td class='base'> </td>
1041 <td><img src='/images/updbooster/updxl-globe.gif' alt='$Lang::tr{'updxlrtr last checkup'}' /></td>
1042 <td class='base'>$Lang::tr{'updxlrtr last checkup'}</td>
1043 <td class='base'> </td>
1044 <td><img src='/images/delete.gif' alt='$Lang::tr{'updxlrtr remove file'}' /></td>
1045 <td class='base'>$Lang::tr{'updxlrtr remove file'}</td>
1046 <td class='base'> </td>
1047 <td class='base'> </td>
1048 <td class='base'> </td>
1051 <td colspan='13'><br></td>
1054 <td class='base'> $Lang::tr{'status'}:</td>
1055 <td class='base'> </td>
1056 <td align='center'><img src='/images/updbooster/updxl-led-green.gif' alt='$Lang::tr{'updxlrtr condition ok'}' /></td>
1057 <td class='base'>$Lang::tr{'updxlrtr condition ok'}</td>
1058 <td class='base'> </td>
1059 <td align='center'><img src='/images/updbooster/updxl-led-yellow.gif' alt='$Lang::tr{'updxlrtr condition nosource'}' /></td>
1060 <td class='base'>$Lang::tr{'updxlrtr condition nosource'}</td>
1061 <td class='base'> </td>
1062 <td align='center'><img src='/images/updbooster/updxl-led-red.gif' alt='$Lang::tr{'updxlrtr condition outdated'}' /></td>
1063 <td class='base'>$Lang::tr{'updxlrtr condition outdated'}</td>
1064 <td class='base'> </td>
1065 <td align='center'> </td>
1066 <td class='base'> </td>
1069 <td class='base'> </td>
1070 <td class='base'> </td>
1071 <td align='center'><img src='/images/updbooster/updxl-led-blue.gif' alt='$Lang::tr{'updxlrtr condition download'}' /></td>
1072 <td class='base'>$Lang::tr{'updxlrtr condition download'}</td>
1073 <td class='base'> </td>
1074 <td align='center'><img src='/images/updbooster/updxl-led-gray.gif' alt='$Lang::tr{'updxlrtr condition unknown'}' /></td>
1075 <td class='base'>$Lang::tr{'updxlrtr condition unknown'}</td>
1076 <td class='base'> </td>
1077 <td align='center'> </td>
1078 <td class='base'> </td>
1079 <td class='base'> </td>
1080 <td align='center'> </td>
1081 <td class='base'> </td>
1084 <td colspan='13'> <br></td>
1087 <td class='base'> $Lang::tr{'updxlrtr source'}:</td>
1088 <td class='base'> </td>
1089 <td align='center'><img src='/images/updbooster/updxl-src-adobe.gif' alt='Adobe' /></td>
1090 <td class='base'>Adobe</td>
1091 <td class='base'> </td>
1092 <td align='center'><img src='/images/updbooster/updxl-src-apple.gif' alt='Apple' /></td>
1093 <td class='base'>Apple</td>
1094 <td class='base'> </td>
1095 <td align='center'><img src='/images/updbooster/updxl-src-avast.gif' alt='Avast' /></td>
1096 <td class='base'>Avast</td>
1097 <td class='base'> </td>
1098 <td align='center'><img src='/images/updbooster/updxl-src-linux.gif' alt='Linux' /></td>
1099 <td class='base'>Linux</td>
1102 <td colspan='13'></td>
1105 <td class='base'> </td>
1106 <td class='base'> </td>
1107 <td align='center'><img src='/images/updbooster/updxl-src-windows.gif' alt='Microsoft' /></td>
1108 <td class='base'>Microsoft</td>
1109 <td class='base'> </td>
1110 <td align='center'><img src='/images/updbooster/updxl-src-symantec.gif' alt='Symantec' /></td>
1111 <td class='base'>Symantec</td>
1112 <td class='base'> </td>
1113 <td align='center'><img src='/images/updbooster/updxl-src-trendmicro.gif' alt='Trend Micro' /></td>
1114 <td class='base'>Trend Micro</td>
1115 <td class='base'> </td>
1116 <td align='center'><img src='/images/IPFire.png' width='18' height='18' alt='IPFire' /></td>
1117 <td class='base'>IPFire</td>
1120 <td class='base'> </td>
1121 <td class='base'> </td>
1122 <td align='center'><img src='/images/updbooster/updxl-src-avira.gif' alt='Avira' /></td>
1123 <td class='base'>Avira</td>
1124 <td class='base'> </td>
1125 <td align='center'><img src='/images/updbooster/updxl-src-avg.gif' alt='AVG' /></td>
1126 <td class='base'>AVG</td>
1127 <td class='base'> </td>
1128 <td align='center'><img src='/images/updbooster/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr other'}' /></td>
1129 <td class='base'>$Lang::tr{'updxlrtr other'}</td>
1130 <td class='base'> </td>
1131 <td align='center'></td>
1132 <td class='base'> </td>
1140 &Header
::closebox
();
1144 # =====================================================================================
1146 # ----------------------------------------------------
1148 &Header
::closebigbox
();
1150 &Header
::closepage
();
1152 # -------------------------------------------------------------------
1156 if (-e
$chk_cron_dly) { unlink($chk_cron_dly); }
1157 if (-e
$chk_cron_wly) { unlink($chk_cron_wly); }
1158 if (-e
$chk_cron_mly) { unlink($chk_cron_mly); }
1160 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'daily'))
1162 symlink("../bin/checkup",$chk_cron_dly)
1164 symlink("/bin/false",$chk_cron_dly)
1166 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'weekly'))
1168 symlink("../bin/checkup",$chk_cron_wly)
1170 symlink("/bin/false",$chk_cron_wly)
1172 if (($xlratorsettings{'ENABLE_AUTOCHECK'} eq 'on') && ($xlratorsettings{'AUTOCHECK_SCHEDULE'} eq 'monthly'))
1174 symlink("../bin/checkup",$chk_cron_mly)
1176 symlink("/bin/false",$chk_cron_mly)
1179 delete($xlratorsettings{'REMOVE_OBSOLETE'});
1180 delete($xlratorsettings{'REMOVE_NOSOURCE'});
1181 delete($xlratorsettings{'REMOVE_OUTDATED'});
1183 delete($xlratorsettings{'EXTENDED_GUI'});
1185 &General
::writehash
("${General::swroot}/updatexlrator/settings", \
%xlratorsettings);
1188 # -------------------------------------------------------------------
1192 my $percent = $_[0];
1196 if ($percent =~ m/^(\d+)%$/ )
1199 <table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
1203 if ($percent eq "100%") {
1204 print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
1205 } elsif ($percent eq "0%") {
1206 print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
1208 print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
1211 <img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
1217 # -------------------------------------------------------------------
1221 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($_[0]);
1226 # -------------------------------------------------------------------