diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-12 09:42:19 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-12-12 09:42:19 +0100 |
commit | d460914f65254d201911a8346792d680218c8dc3 (patch) | |
tree | af6ab666c48d9f041ec5b10635ed6f2f2e806701 /inc | |
parent | 9e7c840b186fb4ad2cd3768cec49ee348facf3da (diff) | |
download | wallabag-d460914f65254d201911a8346792d680218c8dc3.tar.gz wallabag-d460914f65254d201911a8346792d680218c8dc3.tar.zst wallabag-d460914f65254d201911a8346792d680218c8dc3.zip |
[add] download database if sqlite is on
Diffstat (limited to 'inc')
-rw-r--r-- | inc/poche/Tools.class.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 750553f1..9d8e1fd6 100644 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -249,4 +249,28 @@ class Tools | |||
249 | $lang = explode('.', $userlanguage); | 249 | $lang = explode('.', $userlanguage); |
250 | return str_replace('_', '-', $lang[0]); | 250 | return str_replace('_', '-', $lang[0]); |
251 | } | 251 | } |
252 | |||
253 | public static function status($status_code) | ||
254 | { | ||
255 | if (strpos(php_sapi_name(), 'apache') !== false) { | ||
256 | |||
257 | header('HTTP/1.0 '.$status_code); | ||
258 | } | ||
259 | else { | ||
260 | |||
261 | header('Status: '.$status_code); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | |||
266 | public static function download_db() { | ||
267 | header('Content-Disposition: attachment; filename="poche.sqlite.gz"'); | ||
268 | self::status(200); | ||
269 | |||
270 | header('Content-Transfer-Encoding: binary'); | ||
271 | header('Content-Type: application/octet-stream'); | ||
272 | echo gzencode(file_get_contents(STORAGE_SQLITE)); | ||
273 | |||
274 | exit; | ||
275 | } | ||
252 | } | 276 | } |