public static function hashAllFiles($path)
    {
        $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
        $files = [];

        /** @var UniformResourceLocator $locator */
        $locator = Grav::instance()['locator'];
        if ($locator->isStream($path)) {
            $directory = $locator->getRecursiveIterator($path, $flags);
        } else {
            $directory = new \RecursiveDirectoryIterator($path, $flags);
        }

        $iterator = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);

        foreach ($iterator as $file) {
            $files[] = $file->getPathname() . '?'. $file->getMTime();
        }

        return md5(serialize($files));
    }