class CacheCommandController extends CommandController (View source)

Command controller for managing caches

NOTE: This command controller will run in compile time (as defined in the package bootstrap)

Properties

protected Request $request from  CommandController
protected Response $response from  CommandController
protected Arguments $arguments from  CommandController
protected string $commandMethodName

Name of the command method

from  CommandController
protected ObjectManager $objectManager
protected CommandManager $commandManager from  CommandController
protected ConsoleOutput $output from  CommandController
protected CacheManager $cacheManager
protected LockManager $lockManager
protected PackageManager $packageManager
protected Bootstrap $bootstrap
protected Environment $environment

Methods

__construct()

Constructs the command controller

void
injectCommandManager(CommandManager $commandManager)

No description

void
injectObjectManager(ObjectManagerInterface $objectManager)

No description

void
processRequest(Request $request, Response $response)

Processes a command line request.

string
resolveCommandMethodName()

Resolves and checks the current command method name

void
initializeCommandMethodArguments()

Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.

void
mapRequestArgumentsToControllerArguments()

Maps arguments delivered by the request object to the local controller arguments.

void
forward(string $commandName, string $controllerObjectName = null, array $arguments = [])

Forwards the request to another command and / or CommandController.

void
callCommandMethod()

Calls the specified command method and passes the arguments.

string
getFlowInvocationString()

Returns the CLI Flow command depending on the environment

void
output(string $text, array $arguments = [])

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf

void
outputLine(string $text = '', array $arguments = [])

Outputs specified text to the console window and appends a line break

void
outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)

Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window

void
quit(int $exitCode = 0)

Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.

void
sendAndExit(int $exitCode = 0)

Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.

void
injectCacheManager(CacheManager $cacheManager)

No description

void
injectLockManager(LockManager $lockManager)

No description

void
injectPackageManager(PackageManager $packageManager)

No description

void
injectBootstrap(Bootstrap $bootstrap)

No description

void
injectEnvironment(Environment $environment)

No description

void
flushCommand(bool $force = false)

Flush all caches

void
flushOneCommand(string $identifier)

Flushes a particular cache by its identifier

void
warmupCommand()

Warm up caches

void
listCommand(bool $quiet = false)

List all configured caches and their status if available

void
showCommand(string $cacheIdentifier)

Display details of a cache including a detailed status if available

void
setupCommand(string $cacheIdentifier)

Setup the given Cache if possible

void
setupAllCommand(bool $quiet = false)

Setup all Caches

void
collectGarbageCommand(string $cacheIdentifier = null)

Cache Garbage Collection

void
sysCommand(int $address)

Call system function

void
emitWarmupCaches()

Signals that caches should be warmed up.

Details

__construct()

Constructs the command controller

void injectCommandManager(CommandManager $commandManager)

No description

Parameters

CommandManager $commandManager

Return Value

void

void injectObjectManager(ObjectManagerInterface $objectManager)

No description

Parameters

ObjectManagerInterface $objectManager

Return Value

void

void processRequest(Request $request, Response $response)

Processes a command line request.

Parameters

Request $request

The request object

Response $response

The response, modified by the controller

Return Value

void

Exceptions

InvalidArgumentTypeException
NoSuchCommandException

protected string resolveCommandMethodName()

Resolves and checks the current command method name

Note: The resulting command method name might not have the correct case, which isn't a problem because PHP is case insensitive regarding method names.

Return Value

string

Method name of the current command

Exceptions

NoSuchCommandException

protected void initializeCommandMethodArguments()

Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.

Return Value

void

Exceptions

InvalidArgumentTypeException

protected void mapRequestArgumentsToControllerArguments()

Maps arguments delivered by the request object to the local controller arguments.

Return Value

void

protected void forward(string $commandName, string $controllerObjectName = null, array $arguments = [])

Forwards the request to another command and / or CommandController.

Request is directly transferred to the other command / controller without the need for a new request.

Parameters

string $commandName
string $controllerObjectName
array $arguments

Return Value

void

Exceptions

StopCommandException

protected void callCommandMethod()

Calls the specified command method and passes the arguments.

If the command returns a string, it is appended to the content in the response object. If the command doesn't return anything and a valid view exists, the view is rendered automatically.

Return Value

void

string getFlowInvocationString()

Returns the CLI Flow command depending on the environment

Return Value

string

protected void output(string $text, array $arguments = [])

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

Return Value

void

See also

http://www.php.net/sprintf

protected void outputLine(string $text = '', array $arguments = [])

Outputs specified text to the console window and appends a line break

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

Return Value

void

See also

output()
outputLines()

protected void outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)

Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window

Parameters

string $text

Text to output

array $arguments

Optional arguments to use for sprintf

int $leftPadding

The number of spaces to use for indentation

Return Value

void

See also

outputLine()

protected void quit(int $exitCode = 0)

Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.

If your command relies on functionality which is triggered through the Bootstrap shutdown (such as the persistence framework), you must use quit() instead of exit().

Parameters

int $exitCode

Exit code to return on exit (see http://www.php.net/exit)

Return Value

void

Exceptions

StopCommandException

protected void sendAndExit(int $exitCode = 0)

Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.

Parameters

int $exitCode

Exit code to return on exit

Return Value

void

void injectCacheManager(CacheManager $cacheManager)

No description

Parameters

CacheManager $cacheManager

Return Value

void

void injectLockManager(LockManager $lockManager)

No description

Parameters

LockManager $lockManager

Return Value

void

void injectPackageManager(PackageManager $packageManager)

No description

Parameters

PackageManager $packageManager

Return Value

void

void injectBootstrap(Bootstrap $bootstrap)

No description

Parameters

Bootstrap $bootstrap

Return Value

void

void injectEnvironment(Environment $environment)

No description

Parameters

Environment $environment

Return Value

void

void flushCommand(bool $force = false)

Flush all caches

The flush command flushes all caches (including code caches) which have been registered with Flow's Cache Manager. It will NOT remove any session data, unless you specifically configure the session caches to not be persistent.

If fatal errors caused by a package prevent the compile time bootstrap from running, the removal of any temporary data can be forced by specifying the option --force.

This command does not remove the precompiled data provided by frozen packages unless the --force option is used.

Parameters

bool $force

Force flushing of any temporary data

Return Value

void

See also

neos.flow:cache:warmup
neos.flow:package:freeze
neos.flow:package:refreeze

void flushOneCommand(string $identifier)

Flushes a particular cache by its identifier

Given a cache identifier, this flushes just that one cache. To find the cache identifiers, you can use the configuration:show command with the type set to "Caches".

Note that this does not have a force-flush option since it's not meant to remove temporary code data, resulting into a broken state if code files lack.

Parameters

string $identifier

Cache identifier to flush cache for

Return Value

void

See also

neos.flow:cache:flush
neos.flow:configuration:show

void warmupCommand()

Warm up caches

The warm up caches command initializes and fills – as far as possible – all registered caches to get a snappier response on the first following request. Apart from caches, other parts of the application may hook into this command and execute tasks which take further steps for preparing the app for the big rush.

Return Value

void

See also

neos.flow:cache:flush

void listCommand(bool $quiet = false)

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)

Parameters

bool $quiet

If set, this command only outputs errors & warnings

Return Value

void

Exceptions

StopActionException

See also

neos.flow:cache:show

void showCommand(string $cacheIdentifier)

Display details of a cache including a detailed status if available

Parameters

string $cacheIdentifier

identifier of the cache (for example "Flow_Core")

Return Value

void

Exceptions

StopActionException

See also

neos.flow:cache:list

void setupCommand(string $cacheIdentifier)

Setup the given Cache if possible

Invokes the setup() method on the configured CacheBackend (if it implements the WithSetupInterface) which should setup and validate the backend (i.e. create required database tables, directories, ...)

Parameters

string $cacheIdentifier

Return Value

void

Exceptions

StopActionException

See also

neos.flow:cache:list
neos.flow:cache:setupall

void setupAllCommand(bool $quiet = false)

Setup all Caches

Invokes the setup() method on all configured CacheBackend that implement the WithSetupInterface interface which should setup and validate the backend (i.e. create required database tables, directories, ...)

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

Parameters

bool $quiet

If set, this command only outputs errors & warnings

Return Value

void

Exceptions

StopActionException

See also

neos.flow:cache:setup

void collectGarbageCommand(string $cacheIdentifier = null)

Cache Garbage Collection

Runs the Garbage Collection (collectGarbage) method on all registered caches.

Though the method is defined in the BackendInterface, the implementation can differ and might not remove any data, depending on possibilities of the backend.

Parameters

string $cacheIdentifier

If set, this command only applies to the given cache

Return Value

void

Exceptions

NoSuchCacheException

void sysCommand(int $address)

Call system function

Parameters

int $address

Return Value

void

void emitWarmupCaches()

Signals that caches should be warmed up.

Other application parts may subscribe to this signal and execute additional tasks for preparing the application for the first request.

Return Value

void