MediaWiki REL1_33
GadgetDefinitionNamespaceRepo Class Reference

GadgetRepo implementation where each gadget has a page in the Gadget definition namespace, and scripts and styles are located in the Gadget namespace. More...

Inheritance diagram for GadgetDefinitionNamespaceRepo:
Collaboration diagram for GadgetDefinitionNamespaceRepo:

Public Member Functions

 __construct ()
 
 getGadget ( $id)
 
 getGadgetIds ()
 Get a list of gadget ids from cache/database.
 
 handlePageCreation (LinkTarget $target)
 @inheritDoc
 
 handlePageDeletion (LinkTarget $target)
 @inheritDoc
 
 handlePageUpdate (LinkTarget $target)
 @inheritDoc
 
 purgeGadgetEntry ( $id)
 Update the cache for a specific Gadget whenever it is updated.
 
 purgeGadgetIdsList ()
 Purge the list of gadget ids when a page is deleted or if a new page is created.
 
- Public Member Functions inherited from GadgetRepo
 getStructuredList ()
 Get a list of gadgets sorted by category.
 

Public Attributes

const CACHE_TTL = 86400
 How long in seconds the list of gadget ids and individual gadgets should be cached for (1 day)
 

Private Member Functions

 getGadgetCacheKey ( $id)
 
 getGadgetIdsKey ()
 

Private Attributes

WANObjectCache $wanCache
 

Additional Inherited Members

- Static Public Member Functions inherited from GadgetRepo
static setSingleton ( $repo=null)
 Should only be used by unit tests.
 
static singleton ()
 Get the configured default GadgetRepo.
 

Detailed Description

GadgetRepo implementation where each gadget has a page in the Gadget definition namespace, and scripts and styles are located in the Gadget namespace.

Definition at line 12 of file GadgetDefinitionNamespaceRepo.php.

Constructor & Destructor Documentation

◆ __construct()

GadgetDefinitionNamespaceRepo::__construct ( )

Definition at line 24 of file GadgetDefinitionNamespaceRepo.php.

Member Function Documentation

◆ getGadget()

GadgetDefinitionNamespaceRepo::getGadget ( $id)
Parameters
string$id
Exceptions
InvalidArgumentException
Returns
Gadget

Reimplemented from GadgetRepo.

Definition at line 99 of file GadgetDefinitionNamespaceRepo.php.

References $content, $rev, array(), DB_REPLICA, getGadgetCacheKey(), Gadget\newFromDefinitionContent(), Revision\newFromTitle(), and wfGetDB().

◆ getGadgetCacheKey()

GadgetDefinitionNamespaceRepo::getGadgetCacheKey ( $id)
private
Parameters
string$id
Returns
string

Definition at line 161 of file GadgetDefinitionNamespaceRepo.php.

References and(), and Gadget\GADGET_CLASS_VERSION.

Referenced by getGadget(), and purgeGadgetEntry().

◆ getGadgetIds()

GadgetDefinitionNamespaceRepo::getGadgetIds ( )

Get a list of gadget ids from cache/database.

Returns
string[]

Reimplemented from GadgetRepo.

Definition at line 33 of file GadgetDefinitionNamespaceRepo.php.

References $dbr, $fname, and(), array(), DB_REPLICA, getGadgetIdsKey(), and wfGetDB().

◆ getGadgetIdsKey()

GadgetDefinitionNamespaceRepo::getGadgetIdsKey ( )
private
Returns
string

Definition at line 153 of file GadgetDefinitionNamespaceRepo.php.

Referenced by getGadgetIds(), and purgeGadgetIdsList().

◆ handlePageCreation()

GadgetDefinitionNamespaceRepo::handlePageCreation ( LinkTarget $target)

@inheritDoc

Reimplemented from GadgetRepo.

Definition at line 71 of file GadgetDefinitionNamespaceRepo.php.

References MediaWiki\Linker\LinkTarget\inNamespace(), and purgeGadgetIdsList().

◆ handlePageDeletion()

GadgetDefinitionNamespaceRepo::handlePageDeletion ( LinkTarget $target)

◆ handlePageUpdate()

GadgetDefinitionNamespaceRepo::handlePageUpdate ( LinkTarget $target)

◆ purgeGadgetEntry()

GadgetDefinitionNamespaceRepo::purgeGadgetEntry ( $id)

Update the cache for a specific Gadget whenever it is updated.

Parameters
string$id

Definition at line 146 of file GadgetDefinitionNamespaceRepo.php.

References getGadgetCacheKey().

Referenced by handlePageDeletion(), and handlePageUpdate().

◆ purgeGadgetIdsList()

GadgetDefinitionNamespaceRepo::purgeGadgetIdsList ( )

Purge the list of gadget ids when a page is deleted or if a new page is created.

Definition at line 90 of file GadgetDefinitionNamespaceRepo.php.

References getGadgetIdsKey().

Referenced by handlePageCreation(), and handlePageDeletion().

Member Data Documentation

◆ $wanCache

WANObjectCache GadgetDefinitionNamespaceRepo::$wanCache
private

Definition at line 22 of file GadgetDefinitionNamespaceRepo.php.

◆ CACHE_TTL

const GadgetDefinitionNamespaceRepo::CACHE_TTL = 86400

How long in seconds the list of gadget ids and individual gadgets should be cached for (1 day)

Definition at line 17 of file GadgetDefinitionNamespaceRepo.php.


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