51 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
53 'Cannot override ' . __CLASS__ .
'default instance in operation.'
57 self::$instance = $store;
58 return new ScopedCallback(
function () use ( $previousValue ) {
67 if ( self::$instance ===
null ) {
68 self::$instance =
new self();
92 if ( $this->
cache->getMaxSize() < $size ) {
93 $this->
cache->setMaxSize( $size );
126 foreach ( $goodIDs as $pageID ) {
127 foreach ( $propertyNames as $propertyName ) {
129 if ( $propertyValue ===
false ) {
142 $result =
$dbr->select(
150 'pp_page' => $queryIDs,
151 'pp_propname' => $propertyNames
156 foreach ( $result as $row ) {
157 $pageID = $row->pp_page;
158 $propertyName = $row->pp_propname;
159 $propertyValue = $row->pp_value;
160 $this->
cacheProperty( $pageID, $propertyName, $propertyValue );
189 foreach ( $goodIDs as $pageID ) {
191 if ( $pageProperties ===
false ) {
198 if ( $queryIDs != [] ) {
200 $result =
$dbr->select(
208 'pp_page' => $queryIDs,
214 $pageProperties = [];
215 foreach ( $result as $row ) {
216 $pageID = $row->pp_page;
217 if ( $currentPageID != $pageID ) {
218 if ( $pageProperties != [] ) {
223 $pageProperties = [];
225 $pageProperties[$row->pp_propname] = $row->pp_value;
227 if ( $pageProperties != [] ) {
245 foreach (
$titles as $title ) {
246 $pageID = $title->getArticleID();
252 $pageID =
$titles->getArticleID();
268 if ( $this->
cache->hasField( $pageID, $propertyName, self::CACHE_TTL ) ) {
269 return $this->
cache->getField( $pageID, $propertyName );
271 if ( $this->
cache->hasField( 0, $pageID, self::CACHE_TTL ) ) {
272 $pageProperties = $this->
cache->getField( 0, $pageID );
273 if (
isset( $pageProperties[$propertyName] ) ) {
287 if ( $this->
cache->hasField( 0, $pageID, self::CACHE_TTL ) ) {
288 return $this->
cache->getField( 0, $pageID );
301 $this->
cache->setField( $pageID, $propertyName, $propertyValue );
311 $this->
cache->clear( $pageID );
312 $this->
cache->setField( 0, $pageID, $pageProperties );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Handles a simple LRU key/value map with a maximum number of entries.
Gives access to properties of a page.
static overrideInstance(PageProps $store=null)
Overrides the default instance of this class This is intended for use while testing and will fail if ...
static PageProps $instance
ensureCacheSize( $size)
Ensure that cache has at least this size.
getCachedProperty( $pageID, $propertyName)
Get a property from the cache.
cacheProperty( $pageID, $propertyName, $propertyValue)
Save a property to the cache.
getProperties( $titles, $propertyNames)
Given one or more Titles and one or more names of properties, returns an associative array mapping pa...
const CACHE_TTL
Cache parameters.
getCachedProperties( $pageID)
Get properties from the cache.
__construct()
Create a PageProps object.
cacheProperties( $pageID, $pageProperties)
Save properties to the cache.
getAllProperties( $titles)
Get all page property values.
namespace being checked & $result
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
you have access to all of the normal MediaWiki so you can get a DB use the cache