MediaWiki  1.23.8
ForeignDBViaLBRepo.php
Go to the documentation of this file.
1 <?php
31  protected $wiki;
32 
34  protected $dbName;
35 
37  protected $tablePrefix;
38 
40  protected $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
41 
43  protected $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
44 
48  function __construct( $info ) {
49  parent::__construct( $info );
50  $this->wiki = $info['wiki'];
51  list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki );
52  $this->hasSharedCache = $info['hasSharedCache'];
53  }
54 
58  function getMasterDB() {
59  return wfGetDB( DB_MASTER, array(), $this->wiki );
60  }
61 
65  function getSlaveDB() {
66  return wfGetDB( DB_SLAVE, array(), $this->wiki );
67  }
68 
69  function hasSharedCache() {
70  return $this->hasSharedCache;
71  }
72 
79  function getSharedCacheKey( /*...*/ ) {
80  if ( $this->hasSharedCache() ) {
81  $args = func_get_args();
82  array_unshift( $args, $this->wiki );
83 
84  return implode( ':', $args );
85  } else {
86  return false;
87  }
88  }
89 
90  protected function assertWritableRepo() {
91  throw new MWException( get_class( $this ) . ': write operations are not supported.' );
92  }
93 
94  public function getInfo() {
95  return FileRepo::getInfo();
96  }
97 }
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ForeignDBViaLBRepo\getSlaveDB
getSlaveDB()
Definition: ForeignDBViaLBRepo.php:60
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3659
wiki
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning maintenance scripts have been cleaned up to use a unified class Directory structure How to run a script How to write your own DIRECTORY STRUCTURE The maintenance directory of a MediaWiki installation contains several all of which have unique purposes HOW TO RUN A SCRIPT Ridiculously just call php someScript php that s in the top level maintenance directory if not default wiki
Definition: maintenance.txt:1
FileRepo\getInfo
getInfo()
Return information about the repository.
Definition: FileRepo.php:1846
wfSplitWikiID
wfSplitWikiID( $wiki)
Split a wiki ID into DB name and table prefix.
Definition: GlobalFunctions.php:3629
ForeignDBViaLBRepo\$fileFromRowFactory
array $fileFromRowFactory
Definition: ForeignDBViaLBRepo.php:38
ForeignDBViaLBRepo\$wiki
string $wiki
Definition: ForeignDBViaLBRepo.php:30
ForeignDBViaLBRepo\$dbName
string $dbName
Definition: ForeignDBViaLBRepo.php:32
ForeignDBViaLBRepo\getInfo
getInfo()
Return information about the repository.
Definition: ForeignDBViaLBRepo.php:89
MWException
MediaWiki exception.
Definition: MWException.php:26
ForeignDBViaLBRepo
A foreign repository with a MediaWiki database accessible via the configured LBFactory.
Definition: ForeignDBViaLBRepo.php:29
ForeignDBViaLBRepo\$tablePrefix
string $tablePrefix
Definition: ForeignDBViaLBRepo.php:34
ForeignDBViaLBRepo\$fileFactory
array $fileFactory
Definition: ForeignDBViaLBRepo.php:36
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
ForeignDBViaLBRepo\getMasterDB
getMasterDB()
Definition: ForeignDBViaLBRepo.php:53
ForeignDBViaLBRepo\assertWritableRepo
assertWritableRepo()
Throw an exception if this repo is read-only by design.
Definition: ForeignDBViaLBRepo.php:85
ForeignDBViaLBRepo\getSharedCacheKey
getSharedCacheKey()
Get a key on the primary cache for this repository.
Definition: ForeignDBViaLBRepo.php:74
ForeignDBViaLBRepo\hasSharedCache
hasSharedCache()
Definition: ForeignDBViaLBRepo.php:64
$args
if( $line===false) $args
Definition: cdb.php:62
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
ForeignDBViaLBRepo\__construct
__construct( $info)
Definition: ForeignDBViaLBRepo.php:43
LocalRepo
A repository that stores files in the local filesystem and registers them in the wiki's own database.
Definition: LocalRepo.php:31