Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
TranslatablePageMessageGroupStore Class Reference

Handles DB operations for Translatable pages, and the related cache. More...

Inheritance diagram for TranslatablePageMessageGroupStore:
MessageGroupLoader CachedMessageGroupLoader

Public Member Functions

 __construct (IDatabase $db, MessageGroupWANCache $cache)
 
 getGroups ()
 Return the WikiPageMessageGroups If local variable is set, use that otherwise fetch from the cache.
 
 recache ()
 Clear and refill the cache with the latest values.
 
 clearCache ()
 Clear values from the cache.
 
 getCacheData ()
 Get the data that needs to be stored in the cache.
 
- Public Member Functions inherited from MessageGroupLoader
 isExpired (DependencyWrapper $wrapper)
 Determines if dependencies have expired.
 

Static Public Member Functions

static registerLoader (array &$groupLoader, array $deps)
 Hook: TranslateInitGroupLoaders.
 
static getInstance (IDatabase $db=null, WANObjectCache $cache=null)
 Return an instance of this class using the parameters, if passed, else initialize the necessary dependencies and return an instance.
 

Protected Member Functions

 clearProcessCache ()
 Clears the process cache, mainly the cached groups property.
 
 getTranslatablePageTitles ()
 Fetch page titles marked for translation from the database to store in the cache.
 
 initGroupsFromTitle ( $titles)
 Convert page titles to WikiPageMessageGroup objects.
 

Protected Attributes

 $db
 
 $cache
 
 $groups
 

Detailed Description

Handles DB operations for Translatable pages, and the related cache.

Since
2019.05

Definition at line 20 of file TranslatablePageMessageGroupStore.php.

Constructor & Destructor Documentation

◆ __construct()

TranslatablePageMessageGroupStore::__construct ( IDatabase $db,
MessageGroupWANCache $cache )

Definition at line 37 of file TranslatablePageMessageGroupStore.php.

Member Function Documentation

◆ clearCache()

TranslatablePageMessageGroupStore::clearCache ( )

Clear values from the cache.

Implements CachedMessageGroupLoader.

Definition at line 81 of file TranslatablePageMessageGroupStore.php.

◆ clearProcessCache()

TranslatablePageMessageGroupStore::clearProcessCache ( )
protected

Clears the process cache, mainly the cached groups property.

Definition at line 89 of file TranslatablePageMessageGroupStore.php.

◆ getCacheData()

TranslatablePageMessageGroupStore::getCacheData ( )

Get the data that needs to be stored in the cache.

Returns
DependencyWrapper

Definition at line 98 of file TranslatablePageMessageGroupStore.php.

◆ getGroups()

TranslatablePageMessageGroupStore::getGroups ( )

Return the WikiPageMessageGroups If local variable is set, use that otherwise fetch from the cache.

Returns
WikiPageMessageGroup[]

Reimplemented from MessageGroupLoader.

Definition at line 56 of file TranslatablePageMessageGroupStore.php.

◆ getInstance()

static TranslatablePageMessageGroupStore::getInstance ( IDatabase $db = null,
WANObjectCache $cache = null )
static

Return an instance of this class using the parameters, if passed, else initialize the necessary dependencies and return an instance.

Parameters
IDatabase | null$db
WANObjectCache | null$cache
Returns
self

Definition at line 134 of file TranslatablePageMessageGroupStore.php.

◆ getTranslatablePageTitles()

TranslatablePageMessageGroupStore::getTranslatablePageTitles ( )
protected

Fetch page titles marked for translation from the database to store in the cache.

Returns
string[]

Definition at line 149 of file TranslatablePageMessageGroupStore.php.

◆ initGroupsFromTitle()

TranslatablePageMessageGroupStore::initGroupsFromTitle ( $titles)
protected

Convert page titles to WikiPageMessageGroup objects.

Called after the values have been retrieved from the cache.

Parameters
string[]$titles
Returns
WikiPageMessageGroup[]

Definition at line 172 of file TranslatablePageMessageGroupStore.php.

◆ recache()

TranslatablePageMessageGroupStore::recache ( )

Clear and refill the cache with the latest values.

Implements CachedMessageGroupLoader.

Definition at line 69 of file TranslatablePageMessageGroupStore.php.

◆ registerLoader()

static TranslatablePageMessageGroupStore::registerLoader ( array & $groupLoader,
array $deps )
static

Hook: TranslateInitGroupLoaders.

Parameters
array&$groupLoader
array$depsDependencies

Definition at line 119 of file TranslatablePageMessageGroupStore.php.

Member Data Documentation

◆ $cache

TranslatablePageMessageGroupStore::$cache
protected

Definition at line 30 of file TranslatablePageMessageGroupStore.php.

◆ $db

TranslatablePageMessageGroupStore::$db
protected

Definition at line 28 of file TranslatablePageMessageGroupStore.php.

◆ $groups

TranslatablePageMessageGroupStore::$groups
protected

Definition at line 35 of file TranslatablePageMessageGroupStore.php.


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