public static function lastModifiedFile($path, $extensions = 'md|yaml')
    {
        $last_modified = 0;

        /** @var UniformResourceLocator $locator */
        $locator = Grav::instance()['locator'];
        $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
        if ($locator->isStream($path)) {
            $directory = $locator->getRecursiveIterator($path, $flags);
        } else {
            $directory = new \RecursiveDirectoryIterator($path, $flags);
        }
        $recursive = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);
        $iterator = new \RegexIterator($recursive, '/^.+\.'.$extensions.'$/i');

        /** @var \RecursiveDirectoryIterator $file */
        foreach ($iterator as $filepath => $file) {
            try {
                $file_modified = $file->getMTime();
                if ($file_modified > $last_modified) {
                    $last_modified = $file_modified;
                }
            } catch (\Exception $e) {
                Grav::instance()['log']->error('Could not process file: ' . $e->getMessage());
            }
        }

        return $last_modified;
    }
public static function lastModifiedFile($path, $extensions = 'md|yaml')
    {
        $last_modified = 0;

        /** @var UniformResourceLocator $locator */
        $locator = Grav::instance()['locator'];
        $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
        if ($locator->isStream($path)) {
            $directory = $locator->getRecursiveIterator($path, $flags);
        } else {
            $directory = new \RecursiveDirectoryIterator($path, $flags);
        }
        $recursive = new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST);
        $iterator = new \RegexIterator($recursive, '/^.+\.'.$extensions.'$/i');

        /** @var \RecursiveDirectoryIterator $file */
        foreach ($iterator as $filepath => $file) {
            try {
                $file_modified = $file->getMTime();
                if ($file_modified > $last_modified) {
                    $last_modified = $file_modified;
                }
            } catch (\Exception $e) {
                Grav::instance()['log']->error('Could not process file: ' . $e->getMessage());
            }
        }

        return $last_modified;
    }
public static function lastModifiedFile ( $ path , $ extensions = 'md|yaml' ) { $ last_modified = 0 ; /** @var UniformResourceLocator $locator */ $ locator = Grav :: instance ( ) [ 'locator' ] ; $ flags = \ RecursiveDirectoryIterator :: SKIP_DOTS ; if ( $ locator -> isStream ( $ path ) ) { $ directory = $ locator -> getRecursiveIterator ( $ path , $ flags ) ; } else { $ directory = new \ RecursiveDirectoryIterator ( $ path , $ flags ) ; } $ recursive = new \ RecursiveIteratorIterator ( $ directory , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ iterator = new \ RegexIterator ( $ recursive , '/^.+\.' . $ extensions . '$/i' ) ; /** @var \RecursiveDirectoryIterator $file */ foreach ( $ iterator as $ filepath => $ file ) { try { $ file_modified = $ file -> getMTime ( ) ; if ( $ file_modified > $ last_modified ) { $ last_modified = $ file_modified ; } } catch ( \ Exception $ e ) { Grav :: instance ( ) [ 'log' ] -> error ( 'Could not process file: ' . $ e -> getMessage ( ) ) ; } } return $ last_modified ; }
Recursively find the last modified time under given path by file.

@param string  $path
@param string  $extensions   which files to search for specifically

@return int
Recursively find the last modified time under given path by file .