Go to the documentation of this file.
16 ->setMethods( [
'doUpdate' ] )->getMock();
17 $update->expects( $this->once() )->method(
'doUpdate' );
31 ->setMethods( [
'merge',
'doUpdate' ] )->getMock();
32 $update1->expects( $this->once() )->method(
'merge' );
33 $update1->expects( $this->never() )->method(
'doUpdate' );
36 ->setMethods( [
'merge',
'doUpdate' ] )->getMock();
37 $update2->expects( $this->never() )->method(
'merge' );
38 $update2->expects( $this->never() )->method(
'doUpdate' );
57 $this->assertSame( 1, $ran,
'Update ran' );
73 $update->expects( $this->never() )
74 ->method(
'doUpdate' );
102 '1' =>
"deferred update 1;\n",
103 '2' =>
"deferred update 2;\n",
104 '2-1' =>
"deferred update 1 within deferred update 2;\n",
105 '2-2' =>
"deferred update 2 within deferred update 2;\n",
106 '3' =>
"deferred update 3;\n",
107 '3-1' =>
"deferred update 1 within deferred update 3;\n",
108 '3-2' =>
"deferred update 2 within deferred update 3;\n",
109 '3-1-1' =>
"deferred update 1 within deferred update 1 within deferred update 3;\n",
110 '3-2-1' =>
"deferred update 1 within deferred update 2 with deferred update 3;\n",
113 function ()
use ( $updates ) {
118 function ()
use ( $updates ) {
121 function ()
use ( $updates ) {
122 echo $updates[
'2-1'];
126 function ()
use ( $updates ) {
127 echo $updates[
'2-2'];
133 function ()
use ( $updates ) {
136 function ()
use ( $updates ) {
137 echo $updates[
'3-1'];
139 function ()
use ( $updates ) {
140 echo $updates[
'3-1-1'];
146 function ()
use ( $updates ) {
147 echo $updates[
'3-2'];
149 function ()
use ( $updates ) {
150 echo $updates[
'3-2-1'];
160 $this->expectOutputString( implode(
'', $updates ) );
167 function ()
use ( &$x ) {
173 function ()
use ( &$y ) {
179 $this->assertNull( $x,
"Update not run yet" );
180 $this->assertNull( $y,
"Update not run yet" );
183 $this->assertEquals(
"Sherity", $x,
"PRESEND update ran" );
184 $this->assertNull( $y,
"POSTSEND update not run yet" );
187 $this->assertEquals(
"Marychu", $y,
"POSTSEND update ran" );
198 '1' =>
"deferred update 1;\n",
199 '2' =>
"deferred update 2;\n",
200 '2-1' =>
"deferred update 1 within deferred update 2;\n",
201 '2-2' =>
"deferred update 2 within deferred update 2;\n",
202 '3' =>
"deferred update 3;\n",
203 '3-1' =>
"deferred update 1 within deferred update 3;\n",
204 '3-2' =>
"deferred update 2 within deferred update 3;\n",
205 '3-1-1' =>
"deferred update 1 within deferred update 1 within deferred update 3;\n",
206 '3-2-1' =>
"deferred update 1 within deferred update 2 with deferred update 3;\n",
210 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
211 $lbFactory->commitMasterChanges( __METHOD__ );
214 function ()
use ( $updates ) {
219 function ()
use ( $updates ) {
222 function ()
use ( $updates ) {
223 echo $updates[
'2-1'];
227 function ()
use ( $updates ) {
228 echo $updates[
'2-2'];
234 function ()
use ( $updates ) {
237 function ()
use ( $updates ) {
238 echo $updates[
'3-1'];
240 function ()
use ( $updates ) {
241 echo $updates[
'3-1-1'];
247 function ()
use ( $updates ) {
248 echo $updates[
'3-2'];
250 function ()
use ( $updates ) {
251 echo $updates[
'3-2-1'];
259 $this->expectOutputString( implode(
'', $updates ) );
275 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
276 $lbFactory->commitMasterChanges( __METHOD__ );
279 function ()
use ( &$x, &$y ) {
282 function ()
use ( &$y ) {
293 $this->assertTrue( $x,
"Outer POSTSEND update ran" );
294 $this->assertTrue( $y,
"Nested PRESEND update ran" );
303 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
304 $this->assertFalse( $lbFactory->hasTransactionRound(),
'Initial state' );
309 $this->assertTrue( $lbFactory->hasTransactionRound(),
'Has transaction' );
313 $this->assertSame( 1, $ran,
'Update ran' );
314 $this->assertFalse( $lbFactory->hasTransactionRound(),
'Final state' );
324 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
325 $this->assertFalse( $lbFactory->hasTransactionRound(),
'Initial state' );
329 function ()
use ( &$ran, $lbFactory ) {
331 $this->assertFalse( $lbFactory->hasTransactionRound(),
'No transaction' );
336 $this->assertSame( 1, $ran,
'Update ran' );
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped $pre
testAddMergeable()
DeferredUpdates::addUpdate DeferredUpdates::push.
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
static addUpdate(DeferrableUpdate $update, $stage=self::POSTSEND)
Add an update to the deferred list to be run later by execute()
static clearPendingUpdates()
Clear all pending updates without performing them.
testAddCallableUpdate()
DeferredUpdates::addCallableUpdate MWCallableUpdate::getOrigin.
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
testPresendAddOnPostsendRun()
DeferredUpdates::doUpdates DeferredUpdates::execute DeferredUpdates::addUpdate.
testDoUpdatesWeb()
DeferredUpdates::doUpdates DeferredUpdates::execute DeferredUpdates::addUpdate.
testGetPendingUpdates()
DeferredUpdates::getPendingUpdates DeferredUpdates::clearPendingUpdates.
static doUpdates( $mode='run', $stage=self::ALL)
Do any deferred updates and clear the list.
static pendingUpdatesCount()
testRunUpdateTransactionScope()
DeferredUpdates::runUpdate.
static getPendingUpdates( $stage=self::ALL)
Deferrable update that must run outside of any explicit LBFactory transaction round.
testDoUpdatesCLI()
DeferredUpdates::doUpdates DeferredUpdates::execute DeferredUpdates::addUpdate.
testAddAndRun()
DeferredUpdates::addUpdate DeferredUpdates::push DeferredUpdates::doUpdates DeferredUpdates::execute ...
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
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
static addCallableUpdate( $callable, $stage=self::POSTSEND, $dbw=null)
Add a callable update.
testRunOuterScopeUpdate()
DeferredUpdates::runUpdate TransactionRoundDefiningUpdate::getOrigin.