diff --git a/interface/web/sites/form/web_vhost_domain.tform.php b/interface/web/sites/form/web_vhost_domain.tform.php index ef365259b83b6ce7100c816cf0a3768d0bbcd2e9..332606de6bc292266f0fb9f8334a2792b1a21513 100644 --- a/interface/web/sites/form/web_vhost_domain.tform.php +++ b/interface/web/sites/form/web_vhost_domain.tform.php @@ -640,24 +640,49 @@ $form["tabs"]['stats'] = array ( //* Backup if ($backup_available) { + + $domain_server_id = null; + if(isset($_REQUEST["id"])) { + $domain_id = $app->functions->intval($_REQUEST["id"]); + if($domain_id) { + $domain_data = $app->db->queryOneRecord('SELECT `server_id` FROM `web_domain` WHERE `domain_id` = ?', $domain_id); + if($domain_data) { + $domain_server_id = $domain_data['server_id']; + } + } + } + if(!$domain_server_id) { + $domain_server_id = $conf['server_id']; + } + $missing_utils = array(); - $compressors_list = array( - 'gzip', - 'gunzip', - 'zip', - 'unzip', - 'pigz', - 'tar', - 'bzip2', - 'bunzip2', - 'xz', - 'unxz', - '7z', - 'rar', - ); - foreach ($compressors_list as $compressor) { - if (!$app->system->is_installed($compressor)) { - array_push($missing_utils, $compressor); + if($domain_server_id != $conf['server_id']) { + $mon = $app->db->queryOneRecord('SELECT `data` FROM `monitor_data` WHERE `server_id` = ? AND `type` = ? ORDER BY `created` DESC', $domain_server_id, 'backup_utils'); + if($mon) { + $missing_utils = unserialize($mon['data']); + if(!$missing_utils) { + $missing_utils = array(); + } + } + } else { + $compressors_list = array( + 'gzip', + 'gunzip', + 'zip', + 'unzip', + 'pigz', + 'tar', + 'bzip2', + 'bunzip2', + 'xz', + 'unxz', + '7z', + 'rar', + ); + foreach ($compressors_list as $compressor) { + if (!$app->system->is_installed($compressor)) { + array_push($missing_utils, $compressor); + } } } $app->tpl->setVar("missing_utils", implode(", ",$missing_utils), true); diff --git a/server/lib/classes/cron.d/100-monitor_backup.inc.php b/server/lib/classes/cron.d/100-monitor_backup.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..40f5362082e262d43d9d62b6d139045cc0b134e9 --- /dev/null +++ b/server/lib/classes/cron.d/100-monitor_backup.inc.php @@ -0,0 +1,110 @@ +load('monitor_tools'); + $this->_tools = new monitor_tools(); + /* end global section for monitor cronjobs */ + + /* the id of the server as int */ + $server_id = intval($conf['server_id']); + + /** The type of the data */ + + + $type = 'backup_utils'; + + $missing_utils = array(); + $compressors_list = array( + 'gzip', + 'gunzip', + 'zip', + 'unzip', + 'pigz', + 'tar', + 'bzip2', + 'bunzip2', + 'xz', + 'unxz', + '7z', + 'rar', + ); + foreach ($compressors_list as $compressor) { + if (!$app->system->is_installed($compressor)) { + $missing_utils[] = $compressor; + } + } + + $res = array(); + $res['server_id'] = $server_id; + $res['type'] = $type; + $res['data'] = array('missing_utils' => $missing_utils); + $res['state'] = 'ok'; + + /* + * Insert the data into the database + */ + $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' . + 'VALUES (?, ?, UNIX_TIMESTAMP(), ?, ?)'; + $app->dbmaster->query($sql, $res['server_id'], $res['type'], serialize($res['data']), $res['state']); + + /* The new data is written, now we can delete the old one */ + $this->_tools->delOldRecords($res['type'], $res['server_id']); + + parent::onRunJob(); + } + + /* this function is optional if it contains no custom code */ + public function onAfterRun() { + parent::onAfterRun(); + } + +}