From 6285e57c49bd06ed52ab997f0dc767576b7da126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 14 Feb 2014 15:11:57 +0100 Subject: [add] link to empty cache in config screen, #454 --- inc/poche/Poche.class.php | 16 ++++++++++++++++ index.php | 4 +++- themes/baggy/config.twig | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 5eba3564..d0e2de1f 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -1057,4 +1057,20 @@ class Poche $feed->genarateFeed(); exit; } + + public function emptyCache() { + $files = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator(CACHE, RecursiveDirectoryIterator::SKIP_DOTS), + RecursiveIteratorIterator::CHILD_FIRST + ); + + foreach ($files as $fileinfo) { + $todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink'); + $todo($fileinfo->getRealPath()); + } + + Tools::logm('empty cache'); + $this->messages->add('s', _('Cache deleted.')); + Tools::redirect(); + } } diff --git a/index.php b/index.php index 60755cf7..1a595ece 100644 --- a/index.php +++ b/index.php @@ -65,7 +65,9 @@ if (isset($_GET['login'])) { } elseif (isset($_GET['import'])) { $import = $poche->import($_GET['from']); } elseif (isset($_GET['download'])) { - Tools::download_db();; + Tools::download_db(); +} elseif (isset($_GET['empty-cache'])) { + $poche->emptyCache(); } elseif (isset($_GET['export'])) { $poche->export(); } elseif (isset($_GET['updatetheme'])) { diff --git a/themes/baggy/config.twig b/themes/baggy/config.twig index d0ec0ca7..598409b9 100644 --- a/themes/baggy/config.twig +++ b/themes/baggy/config.twig @@ -116,4 +116,8 @@ {% if constant('STORAGE') == 'sqlite' %}

{% trans "Click here" %} {% trans "to download your database." %}

{% endif %}

{% trans "Click here" %} {% trans "to export your wallabag data." %}

+ +

{% trans "Cache" %}

+

{% trans "Click here" %} {% trans "to delete cache." %}

+ {% endblock %} -- cgit v1.2.3