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 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'inc/poche') 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(); + } } -- cgit v1.2.3