From 6e9de547c074ad794b6d272eda9bf9b7d7bef792 Mon Sep 17 00:00:00 2001 From: Konstantin Vorobyev Date: Wed, 15 Feb 2017 17:38:48 +0900 Subject: Fix #3030: Add upload the sqlite database feature --- app/Model/ConfigModel.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/Model') diff --git a/app/Model/ConfigModel.php b/app/Model/ConfigModel.php index 945c5e6f..b45199fd 100644 --- a/app/Model/ConfigModel.php +++ b/app/Model/ConfigModel.php @@ -48,6 +48,20 @@ class ConfigModel extends SettingModel return gzencode(file_get_contents(DB_FILENAME)); } + /** + * Replace database file with uploaded one + * + * @access public + * @return boolean + */ + public function uploadDatabase($file) + { + + $this->db->closeConnection(); + $result = file_put_contents(DB_FILENAME, gzdecode(file_get_contents($file))); + return $result == false? false: true; + } + /** * Get the Sqlite database size in bytes * -- cgit v1.2.3