summaryrefslogtreecommitdiff
path: root/app/Model/ConfigModel.php
diff options
context:
space:
mode:
authorKonstantin Vorobyev <vorobyev@coacha.com>2017-02-15 17:38:48 +0900
committerKonstantin Vorobyev <vorobyev@coacha.com>2017-02-15 17:38:48 +0900
commit6e9de547c074ad794b6d272eda9bf9b7d7bef792 (patch)
treed147bb8d8d286e9293b6ce7642906a48d7817603 /app/Model/ConfigModel.php
parent5376bb9e0cf2aad9b12d6fde1f43f92854b55cf9 (diff)
Fix #3030: Add upload the sqlite database feature
Diffstat (limited to 'app/Model/ConfigModel.php')
-rw-r--r--app/Model/ConfigModel.php14
1 files changed, 14 insertions, 0 deletions
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
@@ -49,6 +49,20 @@ class ConfigModel extends SettingModel
}
/**
+ * 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
*
* @access public