backup_stats.php 1.32 KB
Newer Older
Patrick Anders's avatar
Patrick Anders committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';

$list_def_file = 'list/backup_stats.list.php';

/******************************************
* End Form configuration
******************************************/

//* Check permissions for module
$app->auth->check_module_permissions('sites');

$app->load('listform_actions','functions');

class list_action extends listform_actions {

	public function prepareDataRow($rec)
	{
20
		global $app;
Florian Schaal's avatar
Florian Schaal committed
21
		$app->uses('functions');
22

Patrick Anders's avatar
Patrick Anders committed
23
24
25
26
		$rec = parent::prepareDataRow($rec);

		$rec['active'] = "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>";
		if ($rec['backup_interval'] === 'none') {
27
28
			$rec['active']        = "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>";
			$rec['backup_copies'] = 0;
Patrick Anders's avatar
Patrick Anders committed
29
30
		}

31
32
		$recBackup = $app->db->queryOneRecord('SELECT COUNT(backup_id) AS backup_count FROM web_backup WHERE parent_domain_id = ?', $rec['domain_id']);
		$rec['backup_copies_exists'] = $recBackup['backup_count'];
Florian Schaal's avatar
Florian Schaal committed
33
34
35
		unset($recBackup);
		$recBackup = $app->db->queryOneRecord('SELECT SUM(filesize) AS backup_size FROM web_backup WHERE parent_domain_id = ?', $rec['domain_id']);
		$rec['backup_size'] = $app->functions->formatBytes($recBackup['backup_size']);
36

Patrick Anders's avatar
Patrick Anders committed
37
38
39
40
41
		return $rec;
	}
}

$list = new list_action;
Till Brehm's avatar
Till Brehm committed
42
$list->SQLExtWhere = "web_domain.type = 'vhost'";
Patrick Anders's avatar
Patrick Anders committed
43
$list->onLoad();