public static function forceFlushCachesIfNecessary(Bootstrap $bootstrap)
    {
        if (!isset($_SERVER['argv']) || !isset($_SERVER['argv'][1]) || !isset($_SERVER['argv'][2])
            || !in_array($_SERVER['argv'][1], ['neos.flow:cache:flush', 'flow:cache:flush'])
            || !in_array($_SERVER['argv'][2], ['--force', '-f'])) {
            return;
        }

        $bootstrap->getEarlyInstance(CacheManager::class)->flushCaches();
        $environment = $bootstrap->getEarlyInstance(Environment::class);
        Files::emptyDirectoryRecursively($environment->getPathToTemporaryDirectory());

        echo 'Force-flushed caches for "' . $bootstrap->getContext() . '" context.' . PHP_EOL;

        // In production the site will be locked as this is a compiletime request so we need to take care to remove that lock again.
        if ($bootstrap->getContext()->isProduction()) {
            $bootstrap->getEarlyInstance(CoreLockManager::class)->unlockSite();
        }

        exit(0);
    }
public static function forceFlushCachesIfNecessary(Bootstrap $bootstrap)
    {
        if (!isset($_SERVER['argv']) || !isset($_SERVER['argv'][1]) || !isset($_SERVER['argv'][2])
            || !in_array($_SERVER['argv'][1], ['neos.flow:cache:flush', 'flow:cache:flush'])
            || !in_array($_SERVER['argv'][2], ['--force', '-f'])) {
            return;
        }

        $bootstrap->getEarlyInstance(CacheManager::class)->flushCaches();
        $environment = $bootstrap->getEarlyInstance(Environment::class);
        Files::emptyDirectoryRecursively($environment->getPathToTemporaryDirectory());

        echo 'Force-flushed caches for "' . $bootstrap->getContext() . '" context.' . PHP_EOL;

        // In production the site will be locked as this is a compiletime request so we need to take care to remove that lock again.
        if ($bootstrap->getContext()->isProduction()) {
            $bootstrap->getEarlyInstance(CoreLockManager::class)->unlockSite();
        }

        exit(0);
    }
public static function forceFlushCachesIfNecessary ( Bootstrap $ bootstrap ) { if ( ! isset ( $ _SERVER [ 'argv' ] ) || ! isset ( $ _SERVER [ 'argv' ] [ 1 ] ) || ! isset ( $ _SERVER [ 'argv' ] [ 2 ] ) || ! in_array ( $ _SERVER [ 'argv' ] [ 1 ] , [ 'neos.flow:cache:flush' , 'flow:cache:flush' ] ) || ! in_array ( $ _SERVER [ 'argv' ] [ 2 ] , [ '--force' , '-f' ] ) ) { return ; } $ bootstrap -> getEarlyInstance ( CacheManager :: class ) -> flushCaches ( ) ; $ environment = $ bootstrap -> getEarlyInstance ( Environment :: class ) ; Files :: emptyDirectoryRecursively ( $ environment -> getPathToTemporaryDirectory ( ) ) ; echo 'Force-flushed caches for "' . $ bootstrap -> getContext ( ) . '" context.' . PHP_EOL ; // In production the site will be locked as this is a compiletime request so we need to take care to remove that lock again. if ( $ bootstrap -> getContext ( ) -> isProduction ( ) ) { $ bootstrap -> getEarlyInstance ( CoreLockManager :: class ) -> unlockSite ( ) ; } exit ( 0 ) ; }
Does some emergency, forced, low level flush caches if the user told to do
so through the command line.

@param Bootstrap $bootstrap
@return void
Does some emergency forced low level flush caches if the user told to do so through the command line .