diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-19 14:17:20 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-19 14:17:20 +0100 |
commit | 0868e49663a8619809a35b7879e26a83b58ec1b2 (patch) | |
tree | 23448633a0b51347fbea82555c29377538ce102b /lib | |
parent | e40b0701d7afc0d016c3c35ad1fe2a46321b2ad3 (diff) | |
parent | 693ca9a92ff268ecbd16c7bd7795a177869ea785 (diff) | |
download | nextcloud-server-0868e49663a8619809a35b7879e26a83b58ec1b2.tar.gz nextcloud-server-0868e49663a8619809a35b7879e26a83b58ec1b2.zip |
Merge pull request #14980 from owncloud/fix-fileglobalgc
Fix fileglobalgc unlink parameter warnings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/cache/fileglobalgc.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/cache/fileglobalgc.php b/lib/private/cache/fileglobalgc.php index 039992718ab..b07e886f652 100644 --- a/lib/private/cache/fileglobalgc.php +++ b/lib/private/cache/fileglobalgc.php @@ -6,6 +6,9 @@ use OC\BackgroundJob\Job; use OCP\IConfig; class FileGlobalGC extends Job { + // only do cleanup every 5 minutes + const CLEANUP_TTL_SEC = 300; + public function run($argument) { $this->gc(\OC::$server->getConfig(), $this->getCacheDir()); } @@ -39,8 +42,7 @@ class FileGlobalGC extends Job { public function gc(IConfig $config, $cacheDir) { $lastRun = $config->getAppValue('core', 'global_cache_gc_lastrun', 0); $now = time(); - if (($now - $lastRun) < 300) { - // only do cleanup every 5 minutes + if (($now - $lastRun) < self::CLEANUP_TTL_SEC) { return; } $config->setAppValue('core', 'global_cache_gc_lastrun', $now); @@ -48,6 +50,8 @@ class FileGlobalGC extends Job { return; } $paths = $this->getExpiredPaths($cacheDir, $now); - array_walk($paths, 'unlink'); + array_walk($paths, function($file) { + unlink($file); + }); } } |