Go to the documentation of this file.
25 $this->wanCache = MediaWikiServices::getInstance()->getMainWANObjectCache();
37 return $this->wanCache->getWithSetCallback(
42 $setOpts += Database::getCacheSetOptions(
$dbr );
44 return $dbr->selectFieldValues(
47 [
'page_namespace' => NS_GADGET_DEFINITION ],
52 'checkKeys' => [ $key ],
63 if ( $target->
inNamespace( NS_GADGET_DEFINITION ) ) {
72 if ( $target->
inNamespace( NS_GADGET_DEFINITION ) ) {
81 if ( $target->
inNamespace( NS_GADGET_DEFINITION ) ) {
101 $gadget = $this->wanCache->getWithSetCallback(
104 function ( $old, &$ttl,
array &$setOpts )
use ( $id ) {
128 'checkKeys' => [ $key ],
134 if ( $gadget ===
null ) {
135 throw new InvalidArgumentException(
"No gadget registered for '$id'" );
154 return $this->wanCache->makeKey(
'gadgets',
'namespace',
'ids' );
162 return $this->wanCache->makeKey(
const TTL_UNCACHEABLE
Idiom for getWithSetCallback() callbacks to avoid calling set()
const CACHE_TTL
How long in seconds the list of gadget ids and individual gadgets should be cached for (1 day)
handlePageDeletion(LinkTarget $target)
@inheritDoc
static newFromDefinitionContent( $id, GadgetDefinitionContent $content)
Create a object based on the metadata in a GadgetDefinitionContent object.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
namespace and then decline to actually register it file or subcat img or subcat $title
purgeGadgetIdsList()
Purge the list of gadget ids when a page is deleted or if a new page is created.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
getGadgetIds()
Get a list of gadget ids from cache/database.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
GadgetRepo implementation where each gadget has a page in the Gadget definition namespace,...
Multi-datacenter aware caching interface.
handlePageUpdate(LinkTarget $target)
@inheritDoc
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
purgeGadgetEntry( $id)
Update the cache for a specific Gadget whenever it is updated.
const GADGET_CLASS_VERSION
Increment this when changing class structure.
handlePageCreation(LinkTarget $target)
@inheritDoc