eZ Publish  [trunk]
eZStaticCache Class Reference
+ Inheritance diagram for eZStaticCache:
+ Collaboration diagram for eZStaticCache:

List of all members.

Public Member Functions

 __construct ()
 Initialises the static cache object with settings from staticcache.ini.
 alwaysUpdateURLArray ()
 Getter method for eZStaticCache::$alwaysUpdate.
 cachedSiteAccesses ()
 Getter method for eZStaticCache::$cachedSiteAccesses.
 cachedURLArray ()
 Getter method for eZStaticCache::$cachedURLArray.
 cacheURL ($url, $nodeID=false, $skipExisting=false, $delay=true)
 Generates the caches for the url $url using the currently configured storageDirectory().
 generateAlwaysUpdatedCache ($quiet=false, $cli=false, $delay=true)
 Generates the caches for all URLs that must always be generated.
 generateCache ($force=false, $quiet=false, $cli=false, $delay=true)
 Generates the static cache from the configured INI settings.
 generateNodeListCache ($nodeList)
 Generates caches for all the urls of nodes in $nodeList.
 hostName ()
 Getter method for eZStaticCache::$hostName.
 maxCacheDepth ()
 Getter method for eZStaticCache::$maxCacheDepth.
 removeURL ($url)
 Removes the static cache file (index.html) and its directory if it exists.
 storageDirectory ()
 Getter method for eZStaticCache::$staticStorageDir.

Static Public Member Functions

static executeActions ()
 This function goes over the list of recorded actions and excecutes them.
static storeCachedFile ($file, $content)
 Stores the cache file $file with contents $content.

Public Attributes

const USER_AGENT = 'eZ Publish static cache generator'
 User-Agent string.

Private Member Functions

 addAction ($action, $parameters)
 This function adds an action to the list that is used at the end of the request to remove and regenerate static cache files.
 buildCacheDirPart ($dir, $siteAccess)
 A helper method used to create directory parts array.
 buildCacheDirPath ($siteAccess)
 Generates a cache directory parts including path, siteaccess name, site URL depending on the match order type.
 buildCacheFilename ($staticStorageDir, $url)
 Generates a full path to the cache file (index.html) based on the input parameters.
 storeCache ($url, $staticStorageDir, $alternativeStaticLocations=array(), $skipUnlink=false, $delay=true)
 Stores the static cache for $url and hostname defined in site.ini.

Private Attributes

 $alwaysUpdate
 $cachedSiteAccesses = array()
 $cachedURLArray = array()
 $hostName
 $maxCacheDepth
 $staticStorage

Static Private Attributes

static $actionList = array()

Detailed Description

Definition at line 29 of file ezstaticcache.php.


Constructor & Destructor Documentation

Initialises the static cache object with settings from staticcache.ini.

Definition at line 84 of file ezstaticcache.php.


Member Function Documentation

eZStaticCache::addAction ( action,
parameters 
) [private]

This function adds an action to the list that is used at the end of the request to remove and regenerate static cache files.

Parameters:
string$action
array$parameters

Definition at line 568 of file ezstaticcache.php.

Referenced by storeCache().

Getter method for eZStaticCache::$alwaysUpdate.

These URLs are configured with AlwaysUpdateArray in staticcache.ini.

See also:
eZStaticCache::generateAlwaysUpdatedCache()
Returns:
array An array with URLs that is to always be updated.

Definition at line 154 of file ezstaticcache.php.

eZStaticCache::buildCacheDirPart ( dir,
siteAccess 
) [private]

A helper method used to create directory parts array.

Parameters:
string$dir
string$siteAccess
Returns:
array

Definition at line 501 of file ezstaticcache.php.

Referenced by buildCacheDirPath().

eZStaticCache::buildCacheDirPath ( siteAccess) [private]

Generates a cache directory parts including path, siteaccess name, site URL depending on the match order type.

Parameters:
string$siteAccess
Returns:
array

Definition at line 450 of file ezstaticcache.php.

Referenced by storeCache().

eZStaticCache::buildCacheFilename ( staticStorageDir,
url 
) [private]

Generates a full path to the cache file (index.html) based on the input parameters.

Parameters:
string$staticStorageDirThe storage for cache files.
string$urlThe URL for the current item, e.g /news
Returns:
string The full path to the cache file (index.html).

Definition at line 436 of file ezstaticcache.php.

Referenced by storeCache().

Getter method for eZStaticCache::$cachedSiteAccesses.

Returns:
array An array with site-access names that should be cached.

Definition at line 131 of file ezstaticcache.php.

Referenced by __construct(), and storeCache().

Getter method for eZStaticCache::$cachedURLArray.

Returns:
array An array with URLs that is to be cached statically, the URLs may contain wildcards.

Definition at line 141 of file ezstaticcache.php.

Referenced by __construct(), cacheURL(), and generateCache().

eZStaticCache::cacheURL ( url,
nodeID = false,
skipExisting = false,
delay = true 
)

Generates the caches for the url $url using the currently configured storageDirectory().

Parameters:
string$urlThe URL to cache, e.g /news
int | false$nodeIDThe ID of the node to cache, if supplied it will also cache content/view/full/xxx.
bool$skipExistingIf true it will not unlink existing cache files.
Returns:
bool

Implements ezpStaticCache.

Definition at line 317 of file ezstaticcache.php.

Referenced by generateCache(), and generateNodeListCache().

static eZStaticCache::executeActions ( ) [static]

This function goes over the list of recorded actions and excecutes them.

Implements ezpStaticCache.

Definition at line 576 of file ezstaticcache.php.

eZStaticCache::generateAlwaysUpdatedCache ( quiet = false,
cli = false,
delay = true 
)

Generates the caches for all URLs that must always be generated.

Parameters:
bool$quietIf true then the function will not output anything.
eZCLI | false$cliThe eZCLI object or false if no output can be done.
bool$delay

Implements ezpStaticCache.

Definition at line 166 of file ezstaticcache.php.

eZStaticCache::generateCache ( force = false,
quiet = false,
cli = false,
delay = true 
)

Generates the static cache from the configured INI settings.

Parameters:
bool$forceIf true then it will create all static caches even if it is not outdated.
bool$quietIf true then the function will not output anything.
eZCLI | false$cliThe eZCLI object or false if no output can be done.
bool$delay

Implements ezpStaticCache.

Definition at line 227 of file ezstaticcache.php.

Generates caches for all the urls of nodes in $nodeList.

The associative array must have on of these entries:

  • node_id - ID of the node
  • path_identification_string - The path_identification_string from the node table, is used to fetch the node ID if node_id is missing.
Parameters:
array$nodeListAn array with node entries, each entry is either the node ID or an associative array.

Implements ezpStaticCache.

Definition at line 187 of file ezstaticcache.php.

Getter method for eZStaticCache::$hostName.

Deprecated:
deprecated since version 4.4
Returns:
string The currently configured host-name.

Definition at line 101 of file ezstaticcache.php.

Referenced by __construct(), and storeCache().

Getter method for eZStaticCache::$maxCacheDepth.

Returns:
int The maximum depth in the url which will be cached.

Definition at line 121 of file ezstaticcache.php.

Referenced by __construct(), and cacheURL().

Removes the static cache file (index.html) and its directory if it exists.

The directory path is based upon the URL $url and the configured static storage dir.

Parameters:
string$urlThe URL for the current item, e.g /news

Implements ezpStaticCache.

Definition at line 553 of file ezstaticcache.php.

Getter method for eZStaticCache::$staticStorageDir.

Returns:
string The currently configured storage directory for the static cache.

Definition at line 111 of file ezstaticcache.php.

eZStaticCache::storeCache ( url,
staticStorageDir,
alternativeStaticLocations = array(),
skipUnlink = false,
delay = true 
) [private]

Stores the static cache for $url and hostname defined in site.ini.

[SiteSettings].SiteURL for cached siteaccess by fetching the web page using eZHTTPTool::getDataByURL() and storing the fetched HTML data.

Parameters:
string$urlThe URL to cache, e.g /news
string$staticStorageDirThe base directory for storing cache files.
array$alternativeStaticLocations
bool$skipUnlinkIf true it will not unlink existing cache files.
bool$delay

Definition at line 361 of file ezstaticcache.php.

Referenced by cacheURL(), and generateAlwaysUpdatedCache().

static eZStaticCache::storeCachedFile ( file,
content 
) [static]

Stores the cache file $file with contents $content.

Takes care of setting proper permissions on the new file.

Parameters:
string$file
string$content

Definition at line 515 of file ezstaticcache.php.

Referenced by storeCache().


Member Data Documentation

eZStaticCache::$actionList = array() [static, private]

Definition at line 36 of file ezstaticcache.php.

eZStaticCache::$alwaysUpdate [private]

Definition at line 79 of file ezstaticcache.php.

eZStaticCache::$cachedSiteAccesses = array() [private]

Definition at line 72 of file ezstaticcache.php.

eZStaticCache::$cachedURLArray = array() [private]

Definition at line 65 of file ezstaticcache.php.

eZStaticCache::$hostName [private]

Definition at line 44 of file ezstaticcache.php.

eZStaticCache::$maxCacheDepth [private]

Definition at line 58 of file ezstaticcache.php.

eZStaticCache::$staticStorage [private]

Definition at line 51 of file ezstaticcache.php.

const eZStaticCache::USER_AGENT = 'eZ Publish static cache generator'

User-Agent string.

Definition at line 34 of file ezstaticcache.php.

Referenced by storeCache().


The documentation for this class was generated from the following file: