MediaWiki  1.33.0
HistoryBlobCurStub.php
Go to the documentation of this file.
1 <?php
33  public $mCurId;
34 
38  function __construct( $curid = 0 ) {
39  $this->mCurId = $curid;
40  }
41 
48  function setLocation( $id ) {
49  $this->mCurId = $id;
50  }
51 
55  function getText() {
56  $dbr = wfGetDB( DB_REPLICA );
57  $row = $dbr->selectRow( 'cur', [ 'cur_text' ], [ 'cur_id' => $this->mCurId ] );
58  if ( !$row ) {
59  return false;
60  }
61  return $row->cur_text;
62  }
63 }
64 
65 // phpcs:ignore Generic.CodeAnalysis.UnconditionalIfStatement.Found
66 if ( false ) {
67  // Blobs generated by MediaWiki < 1.5 on PHP 4 were serialized with the
68  // class name coerced to lowercase. We can improve efficiency by adding
69  // autoload entries for the lowercase variants of these classes (T166759).
70  // The code below is never executed, but it is picked up by the AutoloadGenerator
71  // parser, which scans for class_alias() calls.
72  class_alias( HistoryBlobCurStub::class, 'historyblobcurstub' );
73 }
php
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
Definition: injection.txt:35
$dbr
$dbr
Definition: testCompression.php:50
HistoryBlobCurStub\setLocation
setLocation( $id)
Sets the location (cur_id) of the main object to which this object points.
Definition: HistoryBlobCurStub.php:48
HistoryBlobCurStub\__construct
__construct( $curid=0)
Definition: HistoryBlobCurStub.php:38
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2636
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
HistoryBlobCurStub
To speed up conversion from 1.4 to 1.5 schema, text rows can refer to the leftover cur table as the b...
Definition: HistoryBlobCurStub.php:31
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
HistoryBlobCurStub\$mCurId
int $mCurId
Definition: HistoryBlobCurStub.php:33
HistoryBlobCurStub\getText
getText()
Definition: HistoryBlobCurStub.php:55