public function listCommand(bool $quiet = false)
    {
        $cacheConfigurations = $this->cacheManager->getCacheConfigurations();
        $defaultConfiguration = $cacheConfigurations['Default'];
        unset($cacheConfigurations['Default']);
        ksort($cacheConfigurations);

        $headers = ['Cache', 'Backend', 'Status'];

        $erroneousCaches = [];
        $rows = [];
        foreach ($cacheConfigurations as $identifier => $configuration) {
            $cache = $this->cacheManager->getCache($identifier);
            if (isset($configuration['persistent']) && $configuration['persistent'] === true) {
                $identifier = $identifier . ' <comment>*</comment>';
            }
            $backendClassName = isset($configuration['backend']) ? '<b>' . $configuration['backend'] . '</b>' : $defaultConfiguration['backend'];
            $cacheBackend = $cache->getBackend();
            if (!$cacheBackend instanceof WithStatusInterface) {
                $status = '?';
            } else {
                $statusResult = $cacheBackend->getStatus();
                if ($statusResult->hasErrors()) {
                    $erroneousCaches[] = $identifier;
                    $status = '<error>ERROR</error>';
                } elseif ($statusResult->hasWarnings()) {
                    $erroneousCaches[] = $identifier;
                    $status = '<comment>WARNING</comment>';
                } else {
                    $status = '<success>OK</success>';
                }
            }
            $row = [$identifier, $backendClassName, $status];
            $rows[] = $row;
        }
        if (!$quiet) {
            $this->output->outputTable($rows, $headers);

            $this->outputLine('<comment>*</comment> = Persistent Cache');
            $this->outputLine('<b>Bold = Custom</b>, Thin = Default');
            $this->outputLine();
        }
        if ($erroneousCaches !== []) {
            $this->outputLine('<error>The following caches contain errors or warnings: %s</error>', [implode(', ', $erroneousCaches)]);
            $quiet || $this->outputLine('Use the <em>neos.flow:cache:show</em> Command for more information');
            $this->quit(1);
            return;
        }
    }
public function listCommand(bool $quiet = false)
    {
        $cacheConfigurations = $this->cacheManager->getCacheConfigurations();
        $defaultConfiguration = $cacheConfigurations['Default'];
        unset($cacheConfigurations['Default']);
        ksort($cacheConfigurations);

        $headers = ['Cache', 'Backend', 'Status'];

        $erroneousCaches = [];
        $rows = [];
        foreach ($cacheConfigurations as $identifier => $configuration) {
            $cache = $this->cacheManager->getCache($identifier);
            if (isset($configuration['persistent']) && $configuration['persistent'] === true) {
                $identifier = $identifier . ' <comment>*</comment>';
            }
            $backendClassName = isset($configuration['backend']) ? '<b>' . $configuration['backend'] . '</b>' : $defaultConfiguration['backend'];
            $cacheBackend = $cache->getBackend();
            if (!$cacheBackend instanceof WithStatusInterface) {
                $status = '?';
            } else {
                $statusResult = $cacheBackend->getStatus();
                if ($statusResult->hasErrors()) {
                    $erroneousCaches[] = $identifier;
                    $status = '<error>ERROR</error>';
                } elseif ($statusResult->hasWarnings()) {
                    $erroneousCaches[] = $identifier;
                    $status = '<comment>WARNING</comment>';
                } else {
                    $status = '<success>OK</success>';
                }
            }
            $row = [$identifier, $backendClassName, $status];
            $rows[] = $row;
        }
        if (!$quiet) {
            $this->output->outputTable($rows, $headers);

            $this->outputLine('<comment>*</comment> = Persistent Cache');
            $this->outputLine('<b>Bold = Custom</b>, Thin = Default');
            $this->outputLine();
        }
        if ($erroneousCaches !== []) {
            $this->outputLine('<error>The following caches contain errors or warnings: %s</error>', [implode(', ', $erroneousCaches)]);
            $quiet || $this->outputLine('Use the <em>neos.flow:cache:show</em> Command for more information');
            $this->quit(1);
            return;
        }
    }
public function listCommand ( bool $ quiet = false ) { $ cacheConfigurations = $ this -> cacheManager -> getCacheConfigurations ( ) ; $ defaultConfiguration = $ cacheConfigurations [ 'Default' ] ; unset ( $ cacheConfigurations [ 'Default' ] ) ; ksort ( $ cacheConfigurations ) ; $ headers = [ 'Cache' , 'Backend' , 'Status' ] ; $ erroneousCaches = [ ] ; $ rows = [ ] ; foreach ( $ cacheConfigurations as $ identifier => $ configuration ) { $ cache = $ this -> cacheManager -> getCache ( $ identifier ) ; if ( isset ( $ configuration [ 'persistent' ] ) && $ configuration [ 'persistent' ] === true ) { $ identifier = $ identifier . ' <comment>*</comment>' ; } $ backendClassName = isset ( $ configuration [ 'backend' ] ) ? '<b>' . $ configuration [ 'backend' ] . '</b>' : $ defaultConfiguration [ 'backend' ] ; $ cacheBackend = $ cache -> getBackend ( ) ; if ( ! $ cacheBackend instanceof WithStatusInterface ) { $ status = '?' ; } else { $ statusResult = $ cacheBackend -> getStatus ( ) ; if ( $ statusResult -> hasErrors ( ) ) { $ erroneousCaches [ ] = $ identifier ; $ status = '<error>ERROR</error>' ; } elseif ( $ statusResult -> hasWarnings ( ) ) { $ erroneousCaches [ ] = $ identifier ; $ status = '<comment>WARNING</comment>' ; } else { $ status = '<success>OK</success>' ; } } $ row = [ $ identifier , $ backendClassName , $ status ] ; $ rows [ ] = $ row ; } if ( ! $ quiet ) { $ this -> output -> outputTable ( $ rows , $ headers ) ; $ this -> outputLine ( '<comment>*</comment> = Persistent Cache' ) ; $ this -> outputLine ( '<b>Bold = Custom</b>, Thin = Default' ) ; $ this -> outputLine ( ) ; } if ( $ erroneousCaches !== [ ] ) { $ this -> outputLine ( '<error>The following caches contain errors or warnings: %s</error>' , [ implode ( ', ' , $ erroneousCaches ) ] ) ; $ quiet || $ this -> outputLine ( 'Use the <em>neos.flow:cache:show</em> Command for more information' ) ; $ this -> quit ( 1 ) ; return ; } }
List all configured caches and their status if available

This command will exit with a code 1 if at least one cache status contains errors or warnings
This allows the command to be easily integrated in CI setups (the --quiet flag can be used to reduce verbosity)

@param bool $quiet If set, this command only outputs errors & warnings
@return void
@see neos.flow:cache:show
@throws NoSuchCacheException | StopActionException
List all configured caches and their status if available