From d677ffa65917568806fda40d26954ffa0cc7305f Mon Sep 17 00:00:00 2001 From: Falko Timme <ft@falkotimme.com> Date: Fri, 28 Feb 2014 19:41:39 +0100 Subject: [PATCH] - Remoting: add correct values for database backup_intervals and backup_copies. --- interface/lib/classes/remoting.inc.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 52d9c608ac..3fe307deb2 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -1763,7 +1763,18 @@ class remoting { $this->dataRecord = $params; $app->sites_database_plugin->processDatabaseInsert($this); - return $this->insertQueryExecute($sql, $params); + $retval = $this->insertQueryExecute($sql, $params); + + // set correct values for backup_interval and backup_copies + if(isset($params['backup_interval']) || isset($params['backup_copies'])){ + $sql_set = array(); + if(isset($params['backup_interval'])) $sql_set[] = "backup_interval = '".$app->db->quote($params['backup_interval'])."'"; + if(isset($params['backup_copies'])) $sql_set[] = "backup_copies = ".$app->functions->intval($params['backup_copies']); + //$app->db->query("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$retval); + $this->updateQueryExecute("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$retval, $retval, $params); + } + + return $retval; } return false; @@ -1786,7 +1797,18 @@ class remoting { $this->id = $primary_id; $this->dataRecord = $params; $app->sites_database_plugin->processDatabaseUpdate($this); - return $this->updateQueryExecute($sql, $primary_id, $params); + $retval = $this->updateQueryExecute($sql, $primary_id, $params); + + // set correct values for backup_interval and backup_copies + if(isset($params['backup_interval']) || isset($params['backup_copies'])){ + $sql_set = array(); + if(isset($params['backup_interval'])) $sql_set[] = "backup_interval = '".$app->db->quote($params['backup_interval'])."'"; + if(isset($params['backup_copies'])) $sql_set[] = "backup_copies = ".$app->functions->intval($params['backup_copies']); + //$app->db->query("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$primary_id); + $this->updateQueryExecute("UPDATE web_database SET ".implode(', ', $sql_set)." WHERE database_id = ".$primary_id, $primary_id, $params); + } + + return $retval; } return false; -- GitLab