ComponentController
extends SystemComponentController
in package
Main controller for Cache
Tags
Table of Contents
Properties
- $cache : CacheLib
- cache instance (can also be set to \Cx\Core_Modules\Cache\Controller\Cache, check preInit())
- $config : array<string|int, mixed>
- Config loaded from YAML
- $cx : Cx
- Main class instance
- $developerDocumentationUrl : string
- URL pointing to the developer documentation for this component
- $enduserDocumentationUrl : string
- URL pointing to the end-user documentation for this component
- $systemComponent : SystemComponent
- Decorated SystemComponent
- $templateDocumentationUrl : string
- URL pointing to the template definitions for this component
Methods
- __call() : mixed
- Decoration: all methods that are not specified in this or child classes call the corresponding method of the decorated SystemComponent
- __construct() : mixed
- Initializes a controller
- addCachefileRecords() : void
- Caches values
- addException() : mixed
- Add an exception that must not get cached
- adjustResponse() : mixed
- Do something with a Response object You may do page alterations here (like changing the metatitle) You may do response alterations here (like set headers) PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH resolve() HOOK.
- clearCache() : mixed
- Wrapper to flush all cache instances
- clearReverseProxyCache() : mixed
- Wrapper to drop a cache page on reverse proxy cache
- clearSsiCache() : mixed
- Wrapper to drop all cached ESI/SSI elements
- clearSsiCachePage() : mixed
- Wrapper to drop the ESI cache for a specific call
- clearUserBasedEsiCache() : mixed
- Clear user based ESI cache
- clearUserBasedPageCache() : mixed
- Clear user based page cache
- deleteAllFiles() : mixed
- Delete all cached file's of the cache system
- deleteComponentFiles() : mixed
- Delete all cached files for a component from cache-folder
- deleteNonPagePageCache() : mixed
- Deletes cached header redirects
- deleteSingleFile() : mixed
- Deletes a file from page cache
- dropCachefile() : void
- Drops the cache for the given component and cache key
- dropCachefileRecord() : void
- Drops a value from cache
- executeCommand() : void
- Execute one of the commands listed in getCommandsForCommandMode()
- forceUserbasedPageCache() : mixed
- Forces page cache to be stored per user
- getCachefileData() : DataSet
- Returns the complete cache file
- getCacheFileNameFromUrl() : string
- Gets the local cache file name for an URL
- getCacheFileNameSearchPartsFromUrl() : mixed
- Returns the validated file search parts of the URL
- getCachefileRecord() : array<string|int, mixed>
- Gets a value from cache
- getCommandDescription() : string
- Returns the description for a command provided by this component
- getCommandsForCommandMode() : array<string|int, mixed>
- Returns a list of command mode commands provided by this component
- getComponent() : SystemComponentController
- Get component controller object
- getConfigValue() : string
- Returns a value from the config tree
- getConfigValues() : array<string|int, mixed>
- Returns part of the config tree
- getController() : Controller
- Returns a controller instance if one already exists
- getControllerClasses() : array<string|int, mixed>
- Returns all Controller class names for this component (except this)
- getControllers() : array<string|int, mixed>
- Returns a list of controllers
- getControllersAccessableByJson() : array<string|int, mixed>
- Returns a list of JsonAdapter class names
- getDeveloperDocumentationUrl() : string
- Returns the URL pointing to the developer documentation of this component.
- getEnduserDocumentationUrl() : string
- Returns the URL pointing to the end-user documentation for this component.
- getEsiContent() : string
- Wrapper to return the ESI/SSI content for a (json)data call
- getRandomizedEsiContent() : string
- Wrapper to get randomizedEsiContent
- getSystemComponent() : SystemComponent
- Returns the SystemComponent this Controller decorates
- getSystemComponentController() : SystemComponentController
- Returns the main controller
- getTemplateDocumentationUrl() : string
- Returns the URL pointing to the template documentation for this component.
- hasAccessToExecuteCommand() : bool
- Check whether the command has access to execute or not.
- internalEsiParsing() : string
- Parses ESI directives internally if configured to do so
- load() : mixed
- Load your component. It is needed for this request.
- parseEsiVars() : string
- Parses the dynamic ESI variables and/or functions in the given content
- postComponentLoad() : mixed
- Do something after all active components are loaded USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
- postContentLoad() : mixed
- Do something after content is loaded from DB
- postContentParse() : mixed
- Do something after a module is loaded
- postFinalize() : mixed
- Ends the contrexx caching after the main template got parsed (frontend only)
- postInit() : mixed
- Do something after system initialization
- postResolve() : mixed
- Do something after resolving is done
- preComponentLoad() : mixed
- Do something before component load * USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
- preContentLoad() : mixed
- Do something before content is loaded from DB
- preContentParse() : mixed
- Do something before a module is loaded
- preFinalize() : mixed
- Do something before main template gets parsed
- preInit() : mixed
- Start cloudrexx caching (in frontend only)
- preResolve() : mixed
- Do something before resolving is done
- registerController() : null
- Registers a controller instance
- registerEventListeners() : mixed
- Registers event listeners
- registerEvents() : mixed
- Register events
- resolve() : mixed
- Called for additional, component specific resolving
- setCachedLocaleData() : mixed
- Sets the cached locale data
- setSystemComponent() : SystemComponent
- Sets the SystemComponent this Controller decorates
- writeCacheFileForRequest() : mixed
- Writes the cache file for the current request
- adjustFullyQualifiedClassName() : string
- This makes sure a FQCN does not contain double backslashes
- clearCacheCommand() : mixed
- Clears the selected type of cache.
- getControllerClassName() : string
- This finds the correct FQCN for a controller name
- loadConfigFile() : array<string|int, mixed>
- Loads a config YAML file
- loadData() : void
- Load data from Component.yml
- removeOutdatedCachefileIndex() : bool
- Drops an outdated index from the file
Properties
$cache
cache instance (can also be set to \Cx\Core_Modules\Cache\Controller\Cache, check preInit())
protected
CacheLib
$cache
$config
Config loaded from YAML
protected
array<string|int, mixed>
$config
= array()
Tree of configs
$cx
Main class instance
protected
Cx
$cx
= null
$developerDocumentationUrl
URL pointing to the developer documentation for this component
protected
string
$developerDocumentationUrl
= ''
Developer documentation URL
$enduserDocumentationUrl
URL pointing to the end-user documentation for this component
protected
string
$enduserDocumentationUrl
= ''
End-user documentation URL
$systemComponent
Decorated SystemComponent
protected
SystemComponent
$systemComponent
$templateDocumentationUrl
URL pointing to the template definitions for this component
protected
string
$templateDocumentationUrl
= ''
Template documentation URL
Methods
__call()
Decoration: all methods that are not specified in this or child classes call the corresponding method of the decorated SystemComponent
public
__call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
- $methodName : string
-
Name of method to call
- $arguments : array<string|int, mixed>
-
List of arguments for the method to call
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Return value of the method to call
__construct()
Initializes a controller
public
__construct(SystemComponent $systemComponent, Cx $cx) : mixed
Parameters
- $systemComponent : SystemComponent
-
SystemComponent to decorate
- $cx : Cx
-
The Cloudrexx main class
addCachefileRecords()
Caches values
public
addCachefileRecords(SystemComponentController $component, string $cacheKey, array<string|int, mixed> $indexFieldNames, array<string|int, mixed> $data[, DateTime $defaultValidUntil = null ]) : void
This is intended for caching arbitrary data. Data is cached in usercache for quick access and additionally in filesystem to avoid loosing cache if memcached decided to drop the entry.
Each record is a list of key/value pairs. Keys are called fieldnames. All fields supplied in $indexFieldNames need to be present in all records. Records will be amended by the fields "cachedAt" and "validUntil" of type \DateTime if not already set.
Parameters
- $component : SystemComponentController
-
Calling component
- $cacheKey : string
-
Key to identify cache by. Only letters and numbers are allowed. Needs to start with an uppercase letter
- $indexFieldNames : array<string|int, mixed>
-
List of field names that are used for identifying records
- $data : array<string|int, mixed>
-
List of records
- $defaultValidUntil : DateTime = null
-
(optional) DateTime to use if a record has no valid "validUntil" field
Tags
addException()
Add an exception that must not get cached
public
addException(string|callable $componentOrCallback[, array<string|int, mixed> $additionalInfo = array() ]) : mixed
Case A: $componentOrCallback is a string, $additionalInfo is an empty array Case B: $componentOrCallback is a string, $additionalInfo is non-empty Case C: $componentOrCallback is a callback, $additionalInfo is an empty array Case D: $componentOrCallback is a callback, $additionalInfo is non-empty
Case A will disable caching for all requests to a component. Case B will disable caching for all requests to a component that meet the criteria defined in $additionalInfo. Case C will execute the callback for each not yet cached request. The current Cx instance will be passed to the callback as the first argument. The currently resolved page will be passed to the callback as the second argument. If the callback returns true, the current request will not be cached, otherwise it will. Case D will ignore $additionalInfo and therefore result in case C.
The format for $additionalInfo is either a list of CMDs or a single entry which is a callback. The former will not cache requests to any of the listed CMDs for the component specified in $componentOrCallback. The latter will execute the callback for any request to the component specified in $componentOrCallback. The currently resolved page will be passed to the callback as the first argument. If the callback returns true, the current request will not be cached, otherwise it will.
If there's already an entry for the component specified in $componentOrCallback one of the following will happen:
- $componentOrCallback is a callback or $additionalInfo is empty: The exception will be blindly added. If at least one of the two (or more) rules match, the request will not get cached.
- $componentOrCallback is a component name and $additionalInfo is non- empty: If there's a hard-coded entry in $this->exceptions in static::endContrexxCaching() for the given component the exception you're trying to add through this method will get overwritten.
Parameters
- $componentOrCallback : string|callable
-
Component name or callback
- $additionalInfo : array<string|int, mixed> = array()
-
(optional) Conditions
adjustResponse()
Do something with a Response object You may do page alterations here (like changing the metatitle) You may do response alterations here (like set headers) PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH resolve() HOOK.
public
adjustResponse(Response $response) : mixed
Parameters
- $response : Response
-
Response object to adjust
Tags
clearCache()
Wrapper to flush all cache instances
public
clearCache([AbstractCache $cacheEngine = null ]) : mixed
Parameters
- $cacheEngine : AbstractCache = null
-
The doctrine cache engine
clearReverseProxyCache()
Wrapper to drop a cache page on reverse proxy cache
public
clearReverseProxyCache(mixed $urlPattern) : mixed
Parameters
- $urlPattern : mixed
clearSsiCache()
Wrapper to drop all cached ESI/SSI elements
public
clearSsiCache([mixed $urlPattern = '' ]) : mixed
Parameters
- $urlPattern : mixed = ''
clearSsiCachePage()
Wrapper to drop the ESI cache for a specific call
public
clearSsiCachePage(string $adapterName, string $adapterMethod[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $adapterName : string
-
(Json)Data adapter name
- $adapterMethod : string
-
(Json)Data method name
- $params : array<string|int, mixed> = array()
-
(optional) params for (Json)Data method call
clearUserBasedEsiCache()
Clear user based ESI cache
public
clearUserBasedEsiCache([string $sessionId = '' ]) : mixed
If argument $sessionId is set, then only the cache of the user (identified by sessionid $sessionId) will be flushed. Otherwise (if $sessionId is not set), the complete user based cache is flushed.
Parameters
- $sessionId : string = ''
-
The session ID of the user of whom to clear the esi cache from. If not set, then all used based cach is flusehd.
clearUserBasedPageCache()
Clear user based page cache
public
clearUserBasedPageCache([string $sessionId = '' ]) : mixed
If argument $sessionId is set, then only the cache of the user (identified by sessionid $sessionId) will be flushed. Otherwise (if $sessionId is not set), the complete user based cache is flushed.
Parameters
- $sessionId : string = ''
-
The session ID of the user of whom to clear the page cache from. If not set, then all used based cach is flusehd.
deleteAllFiles()
Delete all cached file's of the cache system
public
deleteAllFiles([object $cacheEngine = null ]) : mixed
Parameters
- $cacheEngine : object = null
-
The user cache engine
deleteComponentFiles()
Delete all cached files for a component from cache-folder
public
deleteComponentFiles(mixed $componentName) : mixed
Parameters
- $componentName : mixed
deleteNonPagePageCache()
Deletes cached header redirects
public
deleteNonPagePageCache() : mixed
deleteSingleFile()
Deletes a file from page cache
public
deleteSingleFile(int $pageId) : mixed
Parameters
- $pageId : int
-
ID of the page to drop cache of
dropCachefile()
Drops the cache for the given component and cache key
public
dropCachefile(SystemComponentController $component, string $cacheKey) : void
Parameters
- $component : SystemComponentController
-
Calling component
- $cacheKey : string
-
Key to identify cache by
Tags
dropCachefileRecord()
Drops a value from cache
public
dropCachefileRecord(SystemComponentController $component, string $cacheKey, array<string|int, mixed> $indexData) : void
Parameters
- $component : SystemComponentController
-
Calling component
- $cacheKey : string
-
Key to identify cache by
- $indexData : array<string|int, mixed>
-
Indexed list of data to reference a record by
Tags
executeCommand()
Execute one of the commands listed in getCommandsForCommandMode()
public
executeCommand(string $command, array<string|int, mixed> $arguments[, array<string|int, mixed> $dataArguments = array() ]) : void
Parameters
- $command : string
-
Name of command to execute
- $arguments : array<string|int, mixed>
-
List of arguments for the command
- $dataArguments : array<string|int, mixed> = array()
-
(optional) List of data arguments for the command
Tags
forceUserbasedPageCache()
Forces page cache to be stored per user
public
forceUserbasedPageCache() : mixed
getCachefileData()
Returns the complete cache file
public
getCachefileData(SystemComponentController $component, string $cacheKey) : DataSet
Parameters
- $component : SystemComponentController
-
Calling component
- $cacheKey : string
-
Key to identify cache by
Tags
Return values
DataSet —Containing cached records that are still valid
getCacheFileNameFromUrl()
Gets the local cache file name for an URL
public
getCacheFileNameFromUrl(string $url, string $originalUrl[, bool $withCacheInfoPart = true ]) : string
Parameters
- $url : string
-
URL to get file name for
- $originalUrl : string
-
URL of the page that ESI is parsed for
- $withCacheInfoPart : bool = true
-
(optional) Adds info part (default true)
Return values
string —File name (without path)
getCacheFileNameSearchPartsFromUrl()
Returns the validated file search parts of the URL
public
getCacheFileNameSearchPartsFromUrl(mixed $urlPattern, string $originalUrl) : mixed
Parameters
- $urlPattern : mixed
- $originalUrl : string
-
URL of the page that ESI is parsed for
Tags
getCachefileRecord()
Gets a value from cache
public
getCachefileRecord(SystemComponentController $component, string $cacheKey, array<string|int, mixed> $indexData) : array<string|int, mixed>
Parameters
- $component : SystemComponentController
-
Calling component
- $cacheKey : string
-
Key to identify cache by
- $indexData : array<string|int, mixed>
-
Indexed list of data to reference a record by
Tags
Return values
array<string|int, mixed> —Single record amended by the fields "cachedAt" and "validUtil"
getCommandDescription()
Returns the description for a command provided by this component
public
getCommandDescription(string $command[, bool $short = false ]) : string
Parameters
- $command : string
-
The name of the command to fetch the description from
- $short : bool = false
-
Wheter to return short or long description
Return values
string —Command description
getCommandsForCommandMode()
Returns a list of command mode commands provided by this component
public
getCommandsForCommandMode() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of command names
getComponent()
Get component controller object
public
getComponent(string $name) : SystemComponentController
Parameters
- $name : string
-
component name
Return values
SystemComponentController —The requested component controller or null if no such component exists
getConfigValue()
Returns a value from the config tree
public
getConfigValue(string $key) : string
Parameters
- $key : string
-
Slash-separated path to requested branch
Tags
Return values
string —Requested value as string
getConfigValues()
Returns part of the config tree
public
getConfigValues(string $key) : array<string|int, mixed>
Parameters
- $key : string
-
Slash-separated path to requested branch
Tags
Return values
array<string|int, mixed> —Requested values
getController()
Returns a controller instance if one already exists
public
getController(mixed $controllerClass) : Controller
Parameters
- $controllerClass : mixed
-
Short or FQCN controller name
Tags
Return values
Controller —Controller instance
getControllerClasses()
Returns all Controller class names for this component (except this)
public
getControllerClasses() : array<string|int, mixed>
Since this comoponent only has this controller, this returns an empty array
Return values
array<string|int, mixed> —List of Controller class names (without namespace)
getControllers()
Returns a list of controllers
public
getControllers([bool $loadedOnly = true ]) : array<string|int, mixed>
Parameters
- $loadedOnly : bool = true
-
(optional) If false, controller that did not register are instanciated, default true
Return values
array<string|int, mixed> —List of Controller instances
getControllersAccessableByJson()
Returns a list of JsonAdapter class names
public
getControllersAccessableByJson() : array<string|int, mixed>
The array values might be a class name without namespace. In that case the namespace \Cx{component_type}{component_name}\Controller is used. If the array value starts with a backslash, no namespace is added.
Avoid calculation of anything, just return an array!
Return values
array<string|int, mixed> —List of ComponentController classes
getDeveloperDocumentationUrl()
Returns the URL pointing to the developer documentation of this component.
public
getDeveloperDocumentationUrl() : string
Return values
string —URL pointing to the developer documentation
getEnduserDocumentationUrl()
Returns the URL pointing to the end-user documentation for this component.
public
getEnduserDocumentationUrl() : string
Return values
string —URL pointing to the end-user documentation or empty string
getEsiContent()
Wrapper to return the ESI/SSI content for a (json)data call
public
getEsiContent(string $adapterName, string $adapterMethod[, array<string|int, mixed> $params = array() ]) : string
Parameters
- $adapterName : string
-
(Json)Data adapter name
- $adapterMethod : string
-
(Json)Data method name
- $params : array<string|int, mixed> = array()
-
(optional) params for (Json)Data method call
Return values
string —ESI/SSI directives to put into HTML code
getRandomizedEsiContent()
Wrapper to get randomizedEsiContent
public
getRandomizedEsiContent(array<string|int, mixed> $esiContentInfos[, int $count = 1 ]) : string
Each entry of $esiContentInfos consists of an array like:
array(
<adapterName>,
<adapterMethod>,
Parameters
- $esiContentInfos : array<string|int, mixed>
-
List of ESI content info arrays
- $count : int = 1
-
(optional) Number of unique random entries to parse
Return values
string —ESI randomized include code
getSystemComponent()
Returns the SystemComponent this Controller decorates
public
getSystemComponent() : SystemComponent
Return values
SystemComponentgetSystemComponentController()
Returns the main controller
public
getSystemComponentController() : SystemComponentController
Return values
SystemComponentController —Main controller for this system component
getTemplateDocumentationUrl()
Returns the URL pointing to the template documentation for this component.
public
getTemplateDocumentationUrl() : string
Return values
string —URL pointing to the template documentation or empty string
hasAccessToExecuteCommand()
Check whether the command has access to execute or not.
public
hasAccessToExecuteCommand(string $command, array<string|int, mixed> $arguments) : bool
Parameters
- $command : string
-
name of the command to execute
- $arguments : array<string|int, mixed>
-
list of arguments for the command
Return values
boolinternalEsiParsing()
Parses ESI directives internally if configured to do so
public
internalEsiParsing(string $htmlCode) : string
Parameters
- $htmlCode : string
-
HTML code to replace ESI directives in
Return values
string —Parsed HTML code
load()
Load your component. It is needed for this request.
public
load(Page $page) : mixed
This loads your FrontendController or BackendController depending on the mode Cx runs in. For modes other than frontend and backend, nothing is done. If you you'd like to name your Controllers differently, or have another use case, overwrite this.
Parameters
- $page : Page
-
The resolved page
parseEsiVars()
Parses the dynamic ESI variables and/or functions in the given content
public
parseEsiVars(string $content[, int $flags = CacheLib::PARSE_ESI_ALL ]) : string
Parameters
- $content : string
-
Content to parse
- $flags : int = CacheLib::PARSE_ESI_ALL
Return values
string —Parsed content
postComponentLoad()
Do something after all active components are loaded USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
public
postComponentLoad() : mixed
postContentLoad()
Do something after content is loaded from DB
public
postContentLoad(Page $page) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
postContentParse()
Do something after a module is loaded
public
postContentParse(Page $page) : mixed
This method is called only if any module gets loaded for content parsing USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
postFinalize()
Ends the contrexx caching after the main template got parsed (frontend only)
public
postFinalize(string &$endcode) : mixed
Parameters
- $endcode : string
-
The processed data to be sent to the client as response
postInit()
Do something after system initialization
public
postInit(Cx $cx) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE. This event must be registered in the postInit-Hook definition file config/postInitHooks.yml.
Parameters
- $cx : Cx
-
The instance of \Cx\Core\Core\Controller\Cx
postResolve()
Do something after resolving is done
public
postResolve(Page $page) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
preComponentLoad()
Do something before component load * USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE.
public
preComponentLoad() : mixed
This event must be registered in the preComponentLoad-Hook definition file config/preComponentLoadHooks.yml.
preContentLoad()
Do something before content is loaded from DB
public
preContentLoad(Page $page) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
preContentParse()
Do something before a module is loaded
public
preContentParse(Page $page) : mixed
This method is called only if any module gets loaded for content parsing USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $page : Page
-
The resolved page
preFinalize()
Do something before main template gets parsed
public
preFinalize(Sigma $template) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $template : Sigma
-
The main template
preInit()
Start cloudrexx caching (in frontend only)
public
preInit(Cx $cx) : mixed
Parameters
- $cx : Cx
-
The instance of \Cx\Core\Core\Controller\Cx
preResolve()
Do something before resolving is done
public
preResolve(Url $request) : mixed
USE CAREFULLY, DO NOT DO ANYTHING COSTLY HERE! CALCULATE YOUR STUFF AS LATE AS POSSIBLE
Parameters
- $request : Url
-
The URL object for this request
registerController()
Registers a controller instance
public
registerController(Controller $controller) : null
Parameters
- $controller : Controller
-
Controller to register
Return values
nullregisterEventListeners()
Registers event listeners
public
registerEventListeners() : mixed
registerEvents()
Register events
public
registerEvents() : mixed
resolve()
Called for additional, component specific resolving
public
resolve(array<string|int, mixed> $parts, Page $page) : mixed
If /en/Path/to/Page is the path to a page for this component a request like /en/Path/to/Page/with/some/parameters will give an array like array('with', 'some', 'parameters') for $parts PLEASE MAKE SURE THIS METHOD IS MOCKABLE. IT MAY ONLY INTERACT WITH adjustResponse() HOOK.
This may be used to redirect to another page
Parameters
- $parts : array<string|int, mixed>
-
List of additional path parts
- $page : Page
-
Resolved virtual page
setCachedLocaleData()
Sets the cached locale data
public
setCachedLocaleData(Cx $cx) : mixed
Default locale and the following hashtables are cached: <localeCode> to <localeId> <localeCountryCode> to <localeCodes>
Parameters
- $cx : Cx
-
Cx instance
setSystemComponent()
Sets the SystemComponent this Controller decorates
public
setSystemComponent(mixed $systemComponent) : SystemComponent
Parameters
- $systemComponent : mixed
Return values
SystemComponentwriteCacheFileForRequest()
Writes the cache file for the current request
public
writeCacheFileForRequest(Page $page, array<string|int, mixed> $headers, string $endcode) : mixed
Parameters
- $page : Page
-
Current page (might be null for redirects before postResolve)
- $headers : array<string|int, mixed>
-
List of headers set for the current response
- $endcode : string
-
Current response
adjustFullyQualifiedClassName()
This makes sure a FQCN does not contain double backslashes
protected
adjustFullyQualifiedClassName(string $className) : string
Parameters
- $className : string
-
FQCN of a controller
Return values
string —Clean FQCN of a controller
clearCacheCommand()
Clears the selected type of cache.
protected
clearCacheCommand(string $type[, string $options = '' ]) : mixed
Known cache types are:
- user: DB cache
- page: "Contrexx cache"
- esi: ESI/SSI cache (internal or on proxy)
- proxy: Reverse proxy cache
- opcode: PHP OP code cache
- all: Drop all of the above
Parameters
- $type : string
-
Cache type to clear
- $options : string = ''
-
(optional) Engine for user or opcode cache, filter for page, esi and reverse proxy cache
getControllerClassName()
This finds the correct FQCN for a controller name
protected
getControllerClassName(string $controllerClassShort) : string
Parameters
- $controllerClassShort : string
-
Short name for controller
Return values
string —Fully qualified controller class name
loadConfigFile()
Loads a config YAML file
protected
loadConfigFile(string $filename) : array<string|int, mixed>
Parameters
- $filename : string
-
Name of the file to load
Tags
Return values
array<string|int, mixed> —Loaded data
loadData()
Load data from Component.yml
protected
loadData() : void
Tags
removeOutdatedCachefileIndex()
Drops an outdated index from the file
protected
removeOutdatedCachefileIndex(SystemComponentController $component, DataSet $cacheFile, string $index) : bool
This triggers an event and handles the response. If a date in the future is returned it is set as the new valid date for the entry. Otherwise the entry gets dropped. In both cases the dataset needs to be saved after calling this method.
Parameters
- $component : SystemComponentController
-
Component this cachefile belongs to
- $cacheFile : DataSet
-
Cachefile to work on
- $index : string
-
Outdated index
Return values
bool —Returns true
of the entry identified by $index
has been
removed from $cacheFile. Otherwise, if instead the entry's
validUntil-date has been expired, false
is returned.