From 3d06bad1c292ddef53dc384f96bbef7e1cd3725d Mon Sep 17 00:00:00 2001
From: Falko Timme <ft@falkotimme.com>
Date: Fri, 09 Jan 2015 10:32:32 -0500
Subject: [PATCH] - Made sure SQL backups from servers that differ from the server where the website is on can be restored. A download of the backup is not possible in such a case, therefore I hide the "Download" button.

---
 server/plugins-available/backup_plugin.inc.php |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/backup_plugin.inc.php b/server/plugins-available/backup_plugin.inc.php
index b0a4e42..249ca04 100644
--- a/server/plugins-available/backup_plugin.inc.php
+++ b/server/plugins-available/backup_plugin.inc.php
@@ -67,7 +67,7 @@
 
 			$app->uses('ini_parser,file,getconf,system');
 
-			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$backup['parent_domain_id']);
+			$web = $app->dbmaster->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$backup['parent_domain_id']);
 			$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
 			$backup_dir = $server_config['backup_dir'].'/web'.$web['domain_id'];
 			
@@ -100,7 +100,7 @@
 				//* Make backup available for download
 				if($action_name == 'backup_download') {
 					//* Copy the backup file to the backup folder of the website
-					if(file_exists($backup_dir.'/'.$backup['filename']) && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
+					if(file_exists($backup_dir.'/'.$backup['filename']) && file_exists($web['document_root'].'/backup/') && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
 						copy($backup_dir.'/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename']);
 						chgrp($web['document_root'].'/backup/'.$backup['filename'], $web['system_group']);
 						$app->log('cp '.$backup_dir.'/'.$backup['filename'].' '.$web['document_root'].'/backup/'.$backup['filename'], LOGLEVEL_DEBUG);

--
Gitblit v1.9.1