From 5c2f3349fa4341533aad6294c896b32c4befd58f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 13 Aug 2014 20:09:23 +0200 Subject: Long term cookie: purge old tokens https://github.com/marienfressinaud/FreshRSS/issues/465 --- app/Controllers/indexController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/Controllers') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 834db496c..9202f2b85 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -322,7 +322,12 @@ class FreshRSS_index_Controller extends Minz_ActionController { } private static function purgeTokens() { - //TODO: Delete old token files + $oldest = time() - 2629744; //1 month //TODO: Use a configuration instead + foreach (new DirectoryIterator(DATA_PATH . '/tokens/') as $fileInfo) { + if ($fileInfo->getExtension() === 'txt' && $fileInfo->getMTime() < $oldest) { + @unlink($fileInfo->getPathname()); + } + } } public function formLoginAction () { -- cgit v1.2.3