rename MaxArchiveFileSize to ArchiveChunkSize
[BackupPC.git] / lib / BackupPC / Search.pm
index 41f4e76..b1b8bea 100644 (file)
@@ -18,12 +18,12 @@ my $pager_pages = 10;
 my $dsn = $Conf{SearchDSN};
 my $db_user = $Conf{SearchUser} || '';
 
-our $search_module;
-
 sub search_module {
 
-       $search_module = "BackupPC::Search::Estraier";
-       $search_module = "BackupPC::Search::KinoSearch" if $ENV{KINO};
+       my $bpc = BackupPC::Lib->new || die;
+       my %Conf = $bpc->Conf();
+
+       my $search_module = $Conf{SearchModule} || die "search is disabled";
        eval "use $search_module";
        if ( $@ ) {
                warn "ERROR: $search_module: $!";
@@ -31,9 +31,6 @@ sub search_module {
                warn "# using $search_module for full-text search";
        }
 
-       my $bpc = BackupPC::Lib->new || die;
-       my %Conf = $bpc->Conf();
-
        return $search_module->new( %Conf );
 }
 
@@ -149,12 +146,12 @@ my $sort_def = {
        search => {
                default => 'date_a',
                sql => {
-                       share_d => 'shares.name DESC',
-                       share_a => 'shares.name ASC',
-                       path_d => 'files.path DESC',
-                       path_a => 'files.path ASC',
-                       num_d => 'files.backupnum DESC',
-                       num_a => 'files.backupnum ASC',
+                       sname_d => 'shares.name DESC',
+                       sname_a => 'shares.name ASC',
+                       filepath_d => 'files.path DESC',
+                       filepath_a => 'files.path ASC',
+                       backupnum_d => 'files.backupnum DESC',
+                       backupnum_a => 'files.backupnum ASC',
                        size_d => 'files.size DESC',
                        size_a => 'files.size ASC',
                        date_d => 'files.date DESC',
@@ -163,8 +160,8 @@ my $sort_def = {
        }, burn => {
                default => 'date_a',
                sql => {
-                       share_d => 'host DESC, share DESC',
-                       share_a => 'host ASC, share ASC',
+                       sname_d => 'host DESC, share DESC',
+                       sname_a => 'host ASC, share ASC',
                        num_d => 'backupnum DESC',
                        num_a => 'backupnum ASC',
                        date_d => 'date DESC',
@@ -303,10 +300,9 @@ sub getGzipName($$$)
 sub get_tgz_size_by_name($) {
        my $name = shift;
 
-       my $tgz = $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.$name;
+       my $tgz = $Conf{GzipTempDir}.'/'.$name;
        my $size = -1;
 
-       my $Dir = $Conf{InstallDir}."/data/log";
        $|=1;
        if (-f "${tgz}.tar.gz") {
                $size = (stat("${tgz}.tar.gz"))[7];
@@ -377,7 +373,7 @@ sub getGzipSize($$)
 sub getVolumes($) {
        my $id = shift;
 
-       my $max_archive_size = $Conf{MaxArchiveSize} || die "no MaxArchiveSize";
+       my $max_archive_size = $Conf{ArchiveMediaSize} || die "no ArchiveMediaSize";
 
        my $sth = $dbh->prepare(qq{
                select
@@ -453,7 +449,7 @@ print STDERR "## sort=". ($param->{'sort'} || 'no sort param') . " burn sql orde
                $row->{'age'} = sprintf("%0.1f", ( $row->{'age'} / 86400 ) );
                #$row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) );
 
-               my $max_archive_size = $Conf{MaxArchiveSize} || die "no MaxArchiveSize";
+               my $max_archive_size = $Conf{ArchiveMediaSize} || die "no ArchiveMediaSize";
                if ($row->{size} > $max_archive_size) {
                        ($row->{volumes}, $row->{inc_size_calc}) = getVolumes($row->{id});
                }
@@ -473,8 +469,8 @@ sub displayBackupsGrid($) {
 
        my $param = shift;
 
-       my $max_archive_size = $Conf{MaxArchiveSize} || die "no MaxArchiveSize";
-       my $max_archive_file_size = $Conf{MaxArchiveFileSize}  || die "no MaxFileInSize";
+       my $max_archive_size = $Conf{ArchiveMediaSize} || die "no ArchiveMediaSize";
+       my $max_archive_file_size = $Conf{ArchiveChunkSize}  || die "no MaxFileInSize";
 
        my $retHTML .= q{
                <form id="forma" method="POST" action="}.$MyURL.q{?action=burn">
@@ -967,9 +963,9 @@ sub displayGrid($) {
        }
 
        $retHTML .=
-               sort_header($param, 'Share', 'share', 'center') .
-               sort_header($param, 'Type and Name', 'path', 'center') .
-               sort_header($param, '#', 'num', 'center') .
+               sort_header($param, 'Share', 'sname', 'center') .
+               sort_header($param, 'Type and Name', 'filepath', 'center') .
+               sort_header($param, '#', 'backupnum', 'center') .
                sort_header($param, 'Size', 'size', 'center') .
                sort_header($param, 'Date', 'date', 'center');