mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-23 17:42:15 -05:00
[add] download database if sqlite is on
This commit is contained in:
parent
9e7c840b18
commit
d460914f65
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,8 @@ if (isset($_GET['login'])) {
|
||||
$poche->updatePassword();
|
||||
} elseif (isset($_GET['import'])) {
|
||||
$import = $poche->import($_GET['from']);
|
||||
} elseif (isset($_GET['download'])) {
|
||||
Tools::download_db();;
|
||||
} elseif (isset($_GET['export'])) {
|
||||
$poche->export();
|
||||
} elseif (isset($_GET['updatetheme'])) {
|
||||
|
@ -109,5 +109,7 @@
|
||||
</ul>
|
||||
|
||||
<h2>{% trans "Export your poche datas" %}</h2>
|
||||
{% if constant('STORAGE') == 'sqlite' %}
|
||||
<p><a href="?download" target="_blank">{% trans "Click here" %}</a> {% trans "to download your database." %}</p>{% endif %}
|
||||
<p><a href="?export" target="_blank">{% trans "Click here" %}</a> {% trans "to export your poche datas." %}</p>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user