aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/indexController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-08-13 20:09:23 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-08-13 20:09:23 +0200
commit5c2f3349fa4341533aad6294c896b32c4befd58f (patch)
tree781e811f3e11bda2184dd1062ec8e6c74bbfef33 /app/Controllers/indexController.php
parent359ccc8e4c20a60506c680e5054dbe8416fef4a9 (diff)
Long term cookie: purge old tokens
https://github.com/marienfressinaud/FreshRSS/issues/465
Diffstat (limited to 'app/Controllers/indexController.php')
-rwxr-xr-xapp/Controllers/indexController.php7
1 files changed, 6 insertions, 1 deletions
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 () {