mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-26 18:21:02 +00:00
[add] download database if sqlite is on
This commit is contained in:
parent
9e7c840b18
commit
d460914f65
3 changed files with 28 additions and 0 deletions
|
@ -249,4 +249,28 @@ class Tools
|
|||
$lang = explode('.', $userlanguage);
|
||||
return str_replace('_', '-', $lang[0]);
|
||||
}
|
||||
|
||||
public static function status($status_code)
|
||||
{
|
||||
if (strpos(php_sapi_name(), 'apache') !== false) {
|
||||
|
||||
header('HTTP/1.0 '.$status_code);
|
||||
}
|
||||
else {
|
||||
|
||||
header('Status: '.$status_code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function download_db() {
|
||||
header('Content-Disposition: attachment; filename="poche.sqlite.gz"');
|
||||
self::status(200);
|
||||
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Type: application/octet-stream');
|
||||
echo gzencode(file_get_contents(STORAGE_SQLITE));
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue