/** * register hooks for the cache */ public static function registerCacheHooks() { //don't try to do this before we are properly setup if (\OC::$server->getSystemConfig()->getValue('installed', false) && !\OCP\Util::needUpgrade()) { // NOTE: This will be replaced to use OCP $userSession = self::$server->getUserSession(); $userSession->listen('\\OC\\User', 'postLogin', function () { try { $cache = new \OC\Cache\File(); $cache->gc(); } catch (\Exception $e) { // a GC exception should not prevent users from using OC, // so log the exception \OC::$server->getLogger()->warning('Exception when running cache gc: ' . $e->getMessage(), array('app' => 'core')); } }); } }
/** * register hooks for the cache */ public static function registerCacheHooks() { //don't try to do this before we are properly setup if (\OC::$server->getSystemConfig()->getValue('installed', false) && !\OCP\Util::needUpgrade()) { // NOTE: This will be replaced to use OCP $userSession = self::$server->getUserSession(); $userSession->listen('\\OC\\User', 'postLogin', function () { $cache = new \OC\Cache\File(); $cache->gc(); }); } }