[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/cache/ -> BacklinkCache.php (summary)

Class for fetching backlink lists, approximate backlink counts and partitions. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Author: Tim Starling
Author: Aaron Schulz
Copyright: © 2009, Tim Starling, Domas Mituzas
Copyright: © 2010, Max Sem
Copyright: © 2011, Antoine Musso
File Size: 493 lines (14 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

BacklinkCache:: (14 methods):
  __construct()
  get()
  __sleep()
  clear()
  setDB()
  getDB()
  getLinks()
  queryLinks()
  getPrefix()
  getConditions()
  hasLinks()
  getNumLinks()
  partition()
  partitionResult()


Class: BacklinkCache  - X-Ref

Class for fetching backlink lists, approximate backlink counts and
partitions. This is a shared cache.

Instances of this class should typically be fetched with the method
$title->getBacklinkCache().

Ideally you should only get your backlinks from here when you think
there is some advantage in caching them. Otherwise it's just a waste
of memory.

Introduced by r47317

__construct( Title $title )   X-Ref
Create a new BacklinkCache

param: Title $title : Title object to create a backlink cache for

get( Title $title )   X-Ref
Create a new BacklinkCache or reuse any existing one.
Currently, only one cache instance can exist; callers that
need multiple backlink cache objects should keep them in scope.

param: Title $title Title object to get a backlink cache for
return: BacklinkCache

__sleep()   X-Ref
Serialization handler, diasallows to serialize the database to prevent
failures after this class is deserialized from cache with dead DB
connection.

return: array

clear()   X-Ref
Clear locally stored data and database object.


setDB( $db )   X-Ref
Set the Database object to use

param: DatabaseBase $db

getDB()   X-Ref
Get the slave connection to the database
When non existing, will initialize the connection.

return: DatabaseBase

getLinks( $table, $startId = false, $endId = false, $max = INF )   X-Ref
Get the backlinks for a given table. Cached in process memory only.

param: string $table
param: int|bool $startId
param: int|bool $endId
param: int|INF $max
return: TitleArrayFromResult

queryLinks( $table, $startId, $endId, $max, $select = 'all' )   X-Ref
Get the backlinks for a given table. Cached in process memory only.

param: string $table
param: int|bool $startId
param: int|bool $endId
param: int|INF $max
param: string $select 'all' or 'ids'
return: ResultWrapper

getPrefix( $table )   X-Ref
Get the field name prefix for a given table

param: string $table
return: null|string

getConditions( $table )   X-Ref
Get the SQL condition array for selecting backlinks, with a join
on the page table.

param: string $table
return: array|null

hasLinks( $table )   X-Ref
Check if there are any backlinks

param: string $table
return: bool

getNumLinks( $table, $max = INF )   X-Ref
Get the approximate number of backlinks

param: string $table
param: int|INF $max Only count up to this many backlinks
return: int

partition( $table, $batchSize )   X-Ref
Partition the backlinks into batches.
Returns an array giving the start and end of each range. The first
batch has a start of false, and the last batch has an end of false.

param: string $table The links table name
param: int $batchSize
return: array

partitionResult( $res, $batchSize, $isComplete = true )   X-Ref
Partition a DB result with backlinks in it into batches

param: ResultWrapper $res Database result
param: int $batchSize
param: bool $isComplete Whether $res includes all the backlinks
return: array



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1