public function reset_caches($phpunitreset = false) {
        // Clear the on-disk disk with aggregated string files.
        $this->cache->purge();
        $this->menucache->purge();

        if (!$phpunitreset) {
            // Increment the revision counter.
            $langrev = get_config('core', 'langrev');
            $next = time();
            if ($langrev !== false and $next <= $langrev and $langrev - $next < 60*60) {
                // This resolves problems when reset is requested repeatedly within 1s,
                // the < 1h condition prevents accidental switching to future dates
                // because we might not recover from it.
                $next = $langrev+1;
            }
            set_config('langrev', $next);
        }

        // Lang packs use PHP files in dataroot, it is better to invalidate opcode caches.
        if (function_exists('opcache_reset')) {
            opcache_reset();
        }
    }