-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowse.php
More file actions
59 lines (54 loc) · 1.68 KB
/
Copy pathbrowse.php
File metadata and controls
59 lines (54 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require_once(__DIR__ . '/includes/loader.php');
require_once(__DIR__ . '/templates/header.php');
$databases = DBDatabase::getAllDatabases();
if ($databases === false)
exit('Failed to get databases.');
$tableBody = '';
$databaseCount = 0;
foreach ($databases as $database)
{
//Not displaying if the database isn't visible.
if ($database->visible === false)
continue;
++$databaseCount;
$databaseTypeText = $database->connection->type->displayName();
$databaseActiveText = ($database->active === true ? 'Active' : 'Inactive');
$backupFiles = getBackupFiles(BACKUP_ROOT_FOLDER . DIRECTORY_SEPARATOR . $database->uuid . DIRECTORY_SEPARATOR);
$currentBackupCount = count($backupFiles);
$totalBackupSize = humanReadableBytes(getFolderSize($backupFiles));
$tableBody .= <<<HTML
<tr>
<td>{$database->name}</td>
<td>{$databaseTypeText}</td>
<td>{$databaseActiveText}</td>
<td>{$currentBackupCount}</td>
<td>{$database->maxBackupCount}</td>
<td>{$totalBackupSize}</td>
<td><a href="list.php?uuid={$database->uuid}" hx-get="list.php?uuid={$database->uuid}">View</a></td>
</tr>
HTML;
}
$databaseCount = count($databases);
echo <<<HTML
<main>
<h2>Databases ({$databaseCount})</h2>
<table>
<thead>
<tr>
<th>Database</th>
<th>Connection Type</th>
<th>Status</th>
<th title="How many backups are currently available.">Backup Count</th>
<th title="How many backups are kept at a time.">Backup Limit</th>
<th>Backup Size</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{$tableBody}
</tbody>
</table>
</main>
HTML;
require_once(__DIR__ . '/templates/footer.php');