105 |
FROM files |
FROM files |
106 |
INNER JOIN shares ON files.shareID=shares.ID |
INNER JOIN shares ON files.shareID=shares.ID |
107 |
INNER JOIN hosts ON hosts.ID = shares.hostID |
INNER JOIN hosts ON hosts.ID = shares.hostID |
108 |
INNER JOIN backups ON backups.num = files.backupNum and backups.hostID = hosts.ID |
INNER JOIN backups ON backups.num = files.backupNum and backups.hostID = hosts.ID AND backups.shareID = shares.ID |
109 |
}; |
}; |
110 |
|
|
111 |
my $sql_dvd_from = qq{ |
my $sql_dvd_from = qq{ |
169 |
my $dbh = DBI->connect($dsn, $db_user, "", { RaiseError => 1, AutoCommit => 1 } ); |
my $dbh = DBI->connect($dsn, $db_user, "", { RaiseError => 1, AutoCommit => 1 } ); |
170 |
my $sql = q{ |
my $sql = q{ |
171 |
SELECT |
SELECT |
172 |
hosts.ID AS hostid, |
backups.hostID AS hostid, |
173 |
min(hosts.name) AS host, |
min(hosts.name) AS host, |
174 |
backups.num AS backupno, |
backups.num AS backupno, |
175 |
min(backups.type) AS type, |
min(backups.type) AS type, |
176 |
min(backups.date) AS date |
min(backups.date) AS date, |
177 |
FROM backups, shares, files, hosts |
min(backups.size) AS size |
178 |
|
FROM backups |
179 |
|
INNER JOIN hosts ON hosts.ID = backups.hostID |
180 |
WHERE |
WHERE |
|
backups.num = files.backupNum AND |
|
|
shares.ID = files.shareID AND |
|
|
backups.hostID = shares.hostID AND |
|
|
hosts.ID = backups.hostID AND |
|
181 |
files.dvdid IS NULL |
files.dvdid IS NULL |
182 |
GROUP BY |
GROUP BY |
183 |
backups.hostID, backups.num, hosts.id |
backups.hostID, backups.num |
184 |
ORDER BY min(backups.date) |
ORDER BY min(backups.date) |
185 |
}; |
}; |
186 |
my $sth = $dbh->prepare( $sql ); |
my $sth = $dbh->prepare( $sql ); |
187 |
my @ret; |
my @ret; |
188 |
$sth->execute(); |
$sth->execute(); |
189 |
|
|
190 |
while ( my $row = $sth->fetchrow_hashref() ) { |
while ( my $row = $sth->fetchrow_hashref() ) { |
191 |
push(@ret, { |
$row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) ); |
192 |
'host' => $row->{'host'}, |
$row->{'size'} = sprintf("%0.2f", $row->{'size'} / 1024 / 1024); |
193 |
'hostid' => $row->{'hostid'}, |
push @ret, $row; |
|
'backupno' => $row->{'backupno'}, |
|
|
'type' => $row->{'type'}, |
|
|
'date' => $row->{'date'}, |
|
|
'age' => sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) ), |
|
|
} |
|
|
); |
|
194 |
} |
} |
195 |
|
|
196 |
return @ret; |
return @ret; |
239 |
<td class="tableheader">Type</td> |
<td class="tableheader">Type</td> |
240 |
<td class="tableheader">date</td> |
<td class="tableheader">date</td> |
241 |
<td class="tableheader">age/days</td> |
<td class="tableheader">age/days</td> |
242 |
|
<td class="tableheader">size/MB</td> |
243 |
</tr> |
</tr> |
244 |
}; |
}; |
245 |
|
|
271 |
'<td class="fviewborder">' . $backup->{'type'} . '</td>' . |
'<td class="fviewborder">' . $backup->{'type'} . '</td>' . |
272 |
'<td class="fviewborder">' . epoch_to_iso( $backup->{'date'} ) . '</td>' . |
'<td class="fviewborder">' . epoch_to_iso( $backup->{'date'} ) . '</td>' . |
273 |
'<td class="fviewborder">' . $backup->{'age'} . '</td>' . |
'<td class="fviewborder">' . $backup->{'age'} . '</td>' . |
274 |
|
'<td class="fviewborder">' . $backup->{'size'} . '</td>' . |
275 |
'</tr>'; |
'</tr>'; |
276 |
} |
} |
277 |
|
|