]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
[add] link to empty cache in config screen, #454
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 14 Feb 2014 14:11:57 +0000 (15:11 +0100)
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>
Fri, 14 Feb 2014 14:11:57 +0000 (15:11 +0100)
inc/poche/Poche.class.php
index.php
themes/baggy/config.twig

index 5eba3564362e5f9bd6dbdf18def3df074a624b56..d0e2de1f15eeae11898d9277482ed3e4d4bc0a16 100644 (file)
@@ -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();
+    }
 }
index 60755cf70bf0ff0266e6497655019382a8fd977b..1a595ecef4aeafdd52d3488a1ae88a43dcba0229 100644 (file)
--- 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'])) {
index d0ec0ca7930c25ff429015aa7ad96704bbc62038..598409b9e3f03e6faf1b3d3d0d601953a1bd879f 100644 (file)
             {% 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 wallabag data." %}</p>
+
+            <h2>{% trans "Cache" %}</h2>
+            <p><a href="?empty-cache">{% trans "Click here" %}</a> {% trans "to delete cache." %}</p>
+
 {% endblock %}