jenkins-bot has submitted this change and it was merged. Change subject: Use namespaced ScopedCallback ......................................................................
Use namespaced ScopedCallback The un-namespaced \ScopedCallback is deprecated. Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4 --- M includes/EditPage.php M includes/api/ApiStashEdit.php M includes/auth/AuthManager.php M includes/cache/MessageCache.php M includes/context/RequestContext.php M includes/deferred/LinksDeletionUpdate.php M includes/deferred/LinksUpdate.php M includes/jobqueue/JobQueueDB.php M includes/jobqueue/JobRunner.php M includes/jobqueue/jobs/AssembleUploadChunksJob.php M includes/jobqueue/jobs/PublishStashedFileJob.php M includes/libs/filebackend/FileBackend.php M includes/libs/objectcache/BagOStuff.php M includes/libs/rdbms/database/Database.php M includes/libs/rdbms/database/IDatabase.php M includes/libs/rdbms/lbfactory/LBFactory.php M includes/libs/rdbms/loadbalancer/LoadBalancer.php M includes/libs/rdbms/loadmonitor/LoadMonitor.php M includes/libs/xmp/XMP.php M includes/media/SVG.php M includes/parser/Parser.php M includes/parser/ParserOptions.php M includes/profiler/Profiler.php M includes/resourceloader/ResourceLoaderModule.php M includes/session/Session.php M includes/session/SessionBackend.php M includes/session/SessionManager.php M includes/user/User.php M tests/parser/ParserTestRunner.php M tests/parser/fuzzTest.php M tests/phpunit/includes/WatchedItemStoreUnitTest.php M tests/phpunit/includes/auth/AuthManagerTest.php M tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php M tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php M tests/phpunit/includes/changes/RecentChangeTest.php M tests/phpunit/includes/page/WikiCategoryPageTest.php M tests/phpunit/includes/parser/ParserIntegrationTest.php M tests/phpunit/includes/session/PHPSessionHandlerTest.php M tests/phpunit/includes/session/SessionBackendTest.php M tests/phpunit/includes/session/SessionManagerTest.php M tests/phpunit/includes/session/TestUtils.php M tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php M tests/phpunit/includes/user/BotPasswordTest.php M tests/phpunit/suites/ParserTestTopLevelSuite.php 44 files changed, 78 insertions(+), 35 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/EditPage.php b/includes/EditPage.php index 0d8def3..770a74e 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -22,6 +22,7 @@ use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * The edit page/HTML interface (split from Article) diff --git a/includes/api/ApiStashEdit.php b/includes/api/ApiStashEdit.php index 5a2492d..92cbe90 100644 --- a/includes/api/ApiStashEdit.php +++ b/includes/api/ApiStashEdit.php @@ -21,6 +21,7 @@ use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * Prepare an edit in shared cache so that it can be reused on edit diff --git a/includes/auth/AuthManager.php b/includes/auth/AuthManager.php index eeb233e..d88a5b2 100644 --- a/includes/auth/AuthManager.php +++ b/includes/auth/AuthManager.php @@ -2382,7 +2382,7 @@ $session->set( 'AuthManager:lastAuthTimestamp', time() ); $session->persist(); - \ScopedCallback::consume( $delay ); + \Wikimedia\ScopedCallback::consume( $delay ); \Hooks::run( 'UserLoggedIn', [ $user ] ); } diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 6834ac0..48a13c5 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -21,6 +21,7 @@ * @ingroup Cache */ use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * MediaWiki message cache structure version. diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index a8cad9f..ebedb7e 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -25,6 +25,7 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactory; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * Group all the pieces relevant to the context of a request into one instance diff --git a/includes/deferred/LinksDeletionUpdate.php b/includes/deferred/LinksDeletionUpdate.php index 93b3ef6..6aa3831 100644 --- a/includes/deferred/LinksDeletionUpdate.php +++ b/includes/deferred/LinksDeletionUpdate.php @@ -20,6 +20,7 @@ * @file */ use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * Update object handling the cleanup of links tables after a page was deleted. diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 8954304..c7d378e 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -21,6 +21,7 @@ */ use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * Class the manages updates of *_link tables as well as similar extension-managed tables diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php index 856cdfd..aa01768 100644 --- a/includes/jobqueue/JobQueueDB.php +++ b/includes/jobqueue/JobQueueDB.php @@ -21,6 +21,7 @@ * @author Aaron Schulz */ use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * Class to handle job queues stored in the DB diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 84ded8d..0469eeb 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -26,6 +26,7 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactory; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; +use Wikimedia\ScopedCallback; /** * Job queue runner utility methods diff --git a/includes/jobqueue/jobs/AssembleUploadChunksJob.php b/includes/jobqueue/jobs/AssembleUploadChunksJob.php index 060cabb..e2914be 100644 --- a/includes/jobqueue/jobs/AssembleUploadChunksJob.php +++ b/includes/jobqueue/jobs/AssembleUploadChunksJob.php @@ -20,6 +20,7 @@ * @file * @ingroup Upload */ +use Wikimedia\ScopedCallback; /** * Assemble the segments of a chunked upload. diff --git a/includes/jobqueue/jobs/PublishStashedFileJob.php b/includes/jobqueue/jobs/PublishStashedFileJob.php index 78531dc..37e80c2 100644 --- a/includes/jobqueue/jobs/PublishStashedFileJob.php +++ b/includes/jobqueue/jobs/PublishStashedFileJob.php @@ -21,6 +21,7 @@ * @ingroup Upload * @ingroup JobQueue */ +use Wikimedia\ScopedCallback; /** * Upload a file from the upload stash into the local file repo. diff --git a/includes/libs/filebackend/FileBackend.php b/includes/libs/filebackend/FileBackend.php index f33f522..5764cc3 100644 --- a/includes/libs/filebackend/FileBackend.php +++ b/includes/libs/filebackend/FileBackend.php @@ -30,6 +30,7 @@ */ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; +use Wikimedia\ScopedCallback; /** * @brief Base class for all file backend classes (including multi-write backends). diff --git a/includes/libs/objectcache/BagOStuff.php b/includes/libs/objectcache/BagOStuff.php index d3deefb..d0b68bc 100644 --- a/includes/libs/objectcache/BagOStuff.php +++ b/includes/libs/objectcache/BagOStuff.php @@ -29,6 +29,7 @@ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; +use Wikimedia\ScopedCallback; use Wikimedia\WaitConditionLoop; /** diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index a5a170b..a3544f1 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -25,6 +25,7 @@ */ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; +use Wikimedia\ScopedCallback; /** * Relational database abstraction object diff --git a/includes/libs/rdbms/database/IDatabase.php b/includes/libs/rdbms/database/IDatabase.php index c32a7ff..952a2d6 100644 --- a/includes/libs/rdbms/database/IDatabase.php +++ b/includes/libs/rdbms/database/IDatabase.php @@ -23,6 +23,7 @@ * @file * @ingroup Database */ +use Wikimedia\ScopedCallback; /** * Basic database interface for live and lazy-loaded relation database handles diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php b/includes/libs/rdbms/lbfactory/LBFactory.php index 929bd4d..5b35d6b 100644 --- a/includes/libs/rdbms/lbfactory/LBFactory.php +++ b/includes/libs/rdbms/lbfactory/LBFactory.php @@ -22,6 +22,7 @@ */ use Psr\Log\LoggerInterface; +use Wikimedia\ScopedCallback; /** * An interface for generating database load balancers diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index 32df19d..b1c212e 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -21,6 +21,7 @@ * @ingroup Database */ use Psr\Log\LoggerInterface; +use Wikimedia\ScopedCallback; /** * Database connection, tracking, load balancing, and transaction manager for a cluster diff --git a/includes/libs/rdbms/loadmonitor/LoadMonitor.php b/includes/libs/rdbms/loadmonitor/LoadMonitor.php index 99c9126..da4909d 100644 --- a/includes/libs/rdbms/loadmonitor/LoadMonitor.php +++ b/includes/libs/rdbms/loadmonitor/LoadMonitor.php @@ -20,6 +20,7 @@ */ use Psr\Log\LoggerInterface; +use Wikimedia\ScopedCallback; /** * Basic DB load monitor with no external dependencies diff --git a/includes/libs/xmp/XMP.php b/includes/libs/xmp/XMP.php index 70f67b7..29bbf40 100644 --- a/includes/libs/xmp/XMP.php +++ b/includes/libs/xmp/XMP.php @@ -24,6 +24,7 @@ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; +use Wikimedia\ScopedCallback; /** * Class for reading xmp data containing properties relevant to diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 8360920..f3b33ac 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -20,6 +20,7 @@ * @file * @ingroup Media */ +use Wikimedia\ScopedCallback; /** * Handler for SVG images. diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index f0898ba..2c15235 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -22,6 +22,7 @@ */ use MediaWiki\Linker\LinkRenderer; use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * @defgroup Parser Parser @@ -1445,6 +1446,7 @@ $keyword = 'RFC'; $urlmsg = 'rfcurl'; $cssClass = 'mw-magiclink-rfc'; + $trackingCategory = 'magiclinks-rfc-category'; $id = $m[5]; } elseif ( substr( $m[0], 0, 4 ) === 'PMID' ) { if ( !$this->mOptions->getMagicPMIDLinks() ) { @@ -1453,12 +1455,14 @@ $keyword = 'PMID'; $urlmsg = 'pubmedurl'; $cssClass = 'mw-magiclink-pmid'; + $trackingCategory = 'magiclinks-pmid-category'; $id = $m[5]; } else { throw new MWException( __METHOD__ . ': unrecognised match type "' . substr( $m[0], 0, 20 ) . '"' ); } $url = wfMessage( $urlmsg, $id )->inContentLanguage()->text(); + $this->addTrackingCategory( $trackingCategory ); return Linker::makeExternalLink( $url, "{$keyword} {$id}", true, $cssClass, [], $this->mTitle ); } elseif ( isset( $m[6] ) && $m[6] !== '' && $this->mOptions->getMagicISBNLinks() @@ -1472,6 +1476,7 @@ ' ' => '', 'x' => 'X', ] ); + $this->addTrackingCategory( 'magiclinks-isbn-category' ); return $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'Booksources', $num ), "ISBN $isbn", diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 25c2aa4..9a10878 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -20,6 +20,7 @@ * @file * @ingroup Parser */ +use Wikimedia\ScopedCallback; /** * @brief Set options of the Parser diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index db9c95b..8b4f01a 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -21,6 +21,7 @@ * @ingroup Profiler * @defgroup Profiler Profiler */ +use Wikimedia\ScopedCallback; /** * Profiler base class that defines the interface and some trivial diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 3e94460..796c575 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -25,6 +25,7 @@ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; +use Wikimedia\ScopedCallback; /** * Abstraction for ResourceLoader modules, with name registration and maxage functionality. diff --git a/includes/session/Session.php b/includes/session/Session.php index 31761c3..12f16b6 100644 --- a/includes/session/Session.php +++ b/includes/session/Session.php @@ -600,7 +600,7 @@ * * Calls to save() or clear() will not be delayed. * - * @return \ScopedCallback When this goes out of scope, a save will be triggered + * @return \Wikimedia\ScopedCallback When this goes out of scope, a save will be triggered */ public function delaySave() { return $this->backend->delaySave(); diff --git a/includes/session/SessionBackend.php b/includes/session/SessionBackend.php index ea811b6..8633715 100644 --- a/includes/session/SessionBackend.php +++ b/includes/session/SessionBackend.php @@ -586,11 +586,11 @@ * * Calls to save() will not be delayed. * - * @return \ScopedCallback When this goes out of scope, a save will be triggered + * @return \Wikimedia\ScopedCallback When this goes out of scope, a save will be triggered */ public function delaySave() { $this->delaySave++; - return new \ScopedCallback( function () { + return new \Wikimedia\ScopedCallback( function () { if ( --$this->delaySave <= 0 ) { $this->delaySave = 0; $this->save(); @@ -751,7 +751,7 @@ private function checkPHPSession() { if ( !$this->checkPHPSessionRecursionGuard ) { $this->checkPHPSessionRecursionGuard = true; - $reset = new \ScopedCallback( function () { + $reset = new \Wikimedia\ScopedCallback( function () { $this->checkPHPSessionRecursionGuard = false; } ); diff --git a/includes/session/SessionManager.php b/includes/session/SessionManager.php index 87fdcd3..b8e480f 100644 --- a/includes/session/SessionManager.php +++ b/includes/session/SessionManager.php @@ -880,7 +880,7 @@ $session->resetId(); } - \ScopedCallback::consume( $delay ); + \Wikimedia\ScopedCallback::consume( $delay ); return $session; } diff --git a/includes/user/User.php b/includes/user/User.php index 00fc9be..df3b2ac 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -26,6 +26,7 @@ use MediaWiki\Auth\AuthManager; use MediaWiki\Auth\AuthenticationResponse; use MediaWiki\Auth\AuthenticationRequest; +use Wikimedia\ScopedCallback; /** * String Some punctuation to prevent editing from broken text-mangling proxies. diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index a0d6b22..e433c2e 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -26,6 +26,7 @@ * @ingroup Testing */ use MediaWiki\MediaWikiServices; +use Wikimedia\ScopedCallback; /** * @ingroup Testing @@ -175,7 +176,7 @@ // arrays: $setup and $teardown. The code snippets in the $setup array // are executed at the end of the method, before it returns, and the // code snippets in the $teardown array are executed in reverse order - // when the ScopedCallback object is consumed. + // when the Wikimedia\ScopedCallback object is consumed. // Because it is a common operation to save, set and restore global // variables, we have an additional convention: when the array key of diff --git a/tests/parser/fuzzTest.php b/tests/parser/fuzzTest.php index 7437053..9a2a9c9 100644 --- a/tests/parser/fuzzTest.php +++ b/tests/parser/fuzzTest.php @@ -1,5 +1,7 @@ <?php +use Wikimedia\ScopedCallback; + require __DIR__ . '/../../maintenance/Maintenance.php'; // Make RequestContext::resetMain() happy diff --git a/tests/phpunit/includes/WatchedItemStoreUnitTest.php b/tests/phpunit/includes/WatchedItemStoreUnitTest.php index c51d496..ba47059 100644 --- a/tests/phpunit/includes/WatchedItemStoreUnitTest.php +++ b/tests/phpunit/includes/WatchedItemStoreUnitTest.php @@ -1,5 +1,6 @@ <?php use MediaWiki\Linker\LinkTarget; +use Wikimedia\ScopedCallback; /** * @author Addshore diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php b/tests/phpunit/includes/auth/AuthManagerTest.php index dc6fc62..13486e2 100644 --- a/tests/phpunit/includes/auth/AuthManagerTest.php +++ b/tests/phpunit/includes/auth/AuthManagerTest.php @@ -6,6 +6,7 @@ use MediaWiki\Session\UserInfo; use Psr\Log\LogLevel; use StatusValue; +use Wikimedia\ScopedCallback; /** * @group AuthManager @@ -184,7 +185,7 @@ $rProp = new \ReflectionProperty( AuthManager::class, 'instance' ); $rProp->setAccessible( true ); $old = $rProp->getValue(); - $cb = new \ScopedCallback( [ $rProp, 'setValue' ], [ $old ] ); + $cb = new ScopedCallback( [ $rProp, 'setValue' ], [ $old ] ); $rProp->setValue( null ); $singleton = AuthManager::singleton(); @@ -202,11 +203,11 @@ list( $provider, $reset ) = $this->getMockSessionProvider( false ); $this->assertFalse( $this->manager->canAuthenticateNow() ); - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); list( $provider, $reset ) = $this->getMockSessionProvider( true ); $this->assertTrue( $this->manager->canAuthenticateNow() ); - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); } public function testNormalizeUsername() { @@ -385,7 +386,7 @@ $this->unhook( 'SecuritySensitiveOperationStatus' ); } - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); } public function onSecuritySensitiveOperationStatus( &$status, $operation, $session, $time ) { @@ -585,7 +586,7 @@ $this->initializeManager(); $context = \RequestContext::getMain(); - $reset = new \ScopedCallback( [ $context, 'setLanguage' ], [ $context->getLanguage() ] ); + $reset = new ScopedCallback( [ $context, 'setLanguage' ], [ $context->getLanguage() ] ); $context->setLanguage( 'de' ); $this->setMwGlobals( 'wgContLang', \Language::factory( 'zh' ) ); @@ -712,7 +713,7 @@ } $this->unhook( 'UserLoggedIn' ); $this->assertNull( $this->request->getSession()->getSecret( 'AuthManager::authnState' ) ); - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); $this->initializeManager( true ); // CreatedAccountAuthenticationRequest @@ -1449,11 +1450,11 @@ ]; $block = new \Block( $blockOptions ); $block->insert(); - $scopeVariable = new \ScopedCallback( [ $block, 'delete' ] ); + $scopeVariable = new ScopedCallback( [ $block, 'delete' ] ); $status = $this->manager->checkAccountCreatePermissions( new \User ); $this->assertFalse( $status->isOK() ); $this->assertTrue( $status->hasMessage( 'cantcreateaccount-range-text' ) ); - \ScopedCallback::consume( $scopeVariable ); + ScopedCallback::consume( $scopeVariable ); $this->setMwGlobals( [ 'wgEnableDnsBlacklist' => true, diff --git a/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php index e6d3ecf..68f574b 100644 --- a/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/CheckBlocksSecondaryAuthenticationProviderTest.php @@ -152,7 +152,7 @@ ]; $block = new \Block( $blockOptions ); $block->insert(); - $scopeVariable = new \ScopedCallback( [ $block, 'delete' ] ); + $scopeVariable = new \Wikimedia\ScopedCallback( [ $block, 'delete' ] ); $user = \User::newFromName( 'UTNormalUser' ); if ( $user->getID() == 0 ) { diff --git a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php index 8161ed4..bc78c08 100644 --- a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php @@ -2,6 +2,8 @@ namespace MediaWiki\Auth; +use Wikimedia\ScopedCallback; + /** * @group AuthManager * @group Database @@ -70,7 +72,7 @@ } ); } - return new \ScopedCallback( function () { + return new ScopedCallback( function () { \Hooks::clear( 'AlternateUserMailer' ); \Hooks::register( 'AlternateUserMailer', function () { return false; @@ -414,7 +416,7 @@ $dbw = wfGetDB( DB_MASTER ); $oldHash = $dbw->selectField( 'user', 'user_newpassword', [ 'user_name' => $cuser ] ); - $cb = new \ScopedCallback( function () use ( $dbw, $cuser, $oldHash ) { + $cb = new ScopedCallback( function () use ( $dbw, $cuser, $oldHash ) { $dbw->update( 'user', [ 'user_newpassword' => $oldHash ], [ 'user_name' => $cuser ] ); } ); @@ -451,7 +453,7 @@ $changeReq->password = $newpass; $resetMailer = $this->hookMailer(); $provider->providerChangeAuthenticationData( $changeReq ); - \ScopedCallback::consume( $resetMailer ); + ScopedCallback::consume( $resetMailer ); $loginReq->password = $oldpass; $ret = $provider->beginPrimaryAuthentication( $loginReqs ); @@ -573,7 +575,7 @@ return false; } ); $provider->providerChangeAuthenticationData( $req ); - \ScopedCallback::consume( $resetMailer ); + ScopedCallback::consume( $resetMailer ); $this->assertTrue( $mailed ); $priv = \TestingAccessWrapper::newFromObject( $provider ); @@ -723,7 +725,7 @@ $this->assertSame( 'byemail', $provider->finishAccountCreation( $user, $creator, $res ) ); $this->assertTrue( $mailed ); - \ScopedCallback::consume( $resetMailer ); + ScopedCallback::consume( $resetMailer ); $this->assertTrue( $mailed ); } diff --git a/tests/phpunit/includes/changes/RecentChangeTest.php b/tests/phpunit/includes/changes/RecentChangeTest.php index 45f1382..995c4be 100644 --- a/tests/phpunit/includes/changes/RecentChangeTest.php +++ b/tests/phpunit/includes/changes/RecentChangeTest.php @@ -1,4 +1,5 @@ <?php +use Wikimedia\ScopedCallback; /** * @group Database diff --git a/tests/phpunit/includes/page/WikiCategoryPageTest.php b/tests/phpunit/includes/page/WikiCategoryPageTest.php index 9f4e1fa..5f1bf0c 100644 --- a/tests/phpunit/includes/page/WikiCategoryPageTest.php +++ b/tests/phpunit/includes/page/WikiCategoryPageTest.php @@ -1,5 +1,7 @@ <?php +use Wikimedia\ScopedCallback; + class WikiCategoryPageTest extends MediaWikiLangTestCase { /** diff --git a/tests/phpunit/includes/parser/ParserIntegrationTest.php b/tests/phpunit/includes/parser/ParserIntegrationTest.php index b38c98d..c920982 100644 --- a/tests/phpunit/includes/parser/ParserIntegrationTest.php +++ b/tests/phpunit/includes/parser/ParserIntegrationTest.php @@ -1,4 +1,5 @@ <?php +use Wikimedia\ScopedCallback; /** * This is the TestCase subclass for running a single parser test via the diff --git a/tests/phpunit/includes/session/PHPSessionHandlerTest.php b/tests/phpunit/includes/session/PHPSessionHandlerTest.php index 799a97b..34e5e44 100644 --- a/tests/phpunit/includes/session/PHPSessionHandlerTest.php +++ b/tests/phpunit/includes/session/PHPSessionHandlerTest.php @@ -21,7 +21,7 @@ } return false; } ); - $reset[] = new \ScopedCallback( 'restore_error_handler' ); + $reset[] = new \Wikimedia\ScopedCallback( 'restore_error_handler' ); $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); @@ -30,7 +30,7 @@ $oldManager = $old->manager; $oldStore = $old->store; $oldLogger = $old->logger; - $reset[] = new \ScopedCallback( + $reset[] = new \Wikimedia\ScopedCallback( [ PHPSessionHandler::class, 'install' ], [ $oldManager, $oldStore, $oldLogger ] ); @@ -49,7 +49,7 @@ $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); - $reset = new \ScopedCallback( [ $rProp, 'setValue' ], [ $rProp->getValue() ] ); + $reset = new \Wikimedia\ScopedCallback( [ $rProp, 'setValue' ], [ $rProp->getValue() ] ); $rProp->setValue( $handler ); $handler->setEnableFlags( 'enable' ); @@ -123,7 +123,7 @@ ] ); PHPSessionHandler::install( $manager ); $wrap = \TestingAccessWrapper::newFromObject( $rProp->getValue() ); - $reset[] = new \ScopedCallback( + $reset[] = new \Wikimedia\ScopedCallback( [ $wrap, 'setEnableFlags' ], [ $wrap->enable ? $wrap->warn ? 'warn' : 'enable' : 'disable' ] ); @@ -326,7 +326,7 @@ \TestingAccessWrapper::newFromObject( $handler )->setEnableFlags( 'disable' ); $oldValue = $rProp->getValue(); $rProp->setValue( $handler ); - $reset = new \ScopedCallback( [ $rProp, 'setValue' ], [ $oldValue ] ); + $reset = new \Wikimedia\ScopedCallback( [ $rProp, 'setValue' ], [ $oldValue ] ); call_user_func_array( [ $handler, $method ], $args ); } diff --git a/tests/phpunit/includes/session/SessionBackendTest.php b/tests/phpunit/includes/session/SessionBackendTest.php index a3d5de7..8a0adba 100644 --- a/tests/phpunit/includes/session/SessionBackendTest.php +++ b/tests/phpunit/includes/session/SessionBackendTest.php @@ -464,7 +464,7 @@ // Save happens when delay is consumed $this->onSessionMetadataCalled = false; $priv->metaDirty = true; - \ScopedCallback::consume( $delay ); + \Wikimedia\ScopedCallback::consume( $delay ); $this->assertTrue( $this->onSessionMetadataCalled ); // Test multiple delays @@ -475,11 +475,11 @@ $priv->metaDirty = true; $priv->autosave(); $this->assertFalse( $this->onSessionMetadataCalled ); - \ScopedCallback::consume( $delay3 ); + \Wikimedia\ScopedCallback::consume( $delay3 ); $this->assertFalse( $this->onSessionMetadataCalled ); - \ScopedCallback::consume( $delay1 ); + \Wikimedia\ScopedCallback::consume( $delay1 ); $this->assertFalse( $this->onSessionMetadataCalled ); - \ScopedCallback::consume( $delay2 ); + \Wikimedia\ScopedCallback::consume( $delay2 ); $this->assertTrue( $this->onSessionMetadataCalled ); } @@ -822,7 +822,7 @@ $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); $handler = \TestingAccessWrapper::newFromObject( $rProp->getValue() ); - $resetHandler = new \ScopedCallback( function () use ( $handler ) { + $resetHandler = new \Wikimedia\ScopedCallback( function () use ( $handler ) { session_write_close(); $handler->enable = false; } ); @@ -862,7 +862,7 @@ $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); $handler = \TestingAccessWrapper::newFromObject( $rProp->getValue() ); - $resetHandler = new \ScopedCallback( function () use ( $handler ) { + $resetHandler = new \Wikimedia\ScopedCallback( function () use ( $handler ) { session_write_close(); $handler->enable = false; } ); @@ -898,7 +898,7 @@ $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); $handler = \TestingAccessWrapper::newFromObject( $rProp->getValue() ); - $resetHandler = new \ScopedCallback( function () use ( $handler ) { + $resetHandler = new \Wikimedia\ScopedCallback( function () use ( $handler ) { session_write_close(); $handler->enable = false; } ); diff --git a/tests/phpunit/includes/session/SessionManagerTest.php b/tests/phpunit/includes/session/SessionManagerTest.php index 1ebb07c..6273f47 100644 --- a/tests/phpunit/includes/session/SessionManagerTest.php +++ b/tests/phpunit/includes/session/SessionManagerTest.php @@ -62,7 +62,7 @@ $rProp->setAccessible( true ); $handler = \TestingAccessWrapper::newFromObject( $rProp->getValue() ); $oldEnable = $handler->enable; - $reset[] = new \ScopedCallback( function () use ( $handler, $oldEnable ) { + $reset[] = new \Wikimedia\ScopedCallback( function () use ( $handler, $oldEnable ) { if ( $handler->enable ) { session_write_close(); } diff --git a/tests/phpunit/includes/session/TestUtils.php b/tests/phpunit/includes/session/TestUtils.php index 0cc8ebf..f00de55 100644 --- a/tests/phpunit/includes/session/TestUtils.php +++ b/tests/phpunit/includes/session/TestUtils.php @@ -45,7 +45,7 @@ PHPSessionHandler::install( $manager ); } - return new \ScopedCallback( function () use ( &$reset, $oldInstance ) { + return new \Wikimedia\ScopedCallback( function () use ( &$reset, $oldInstance ) { foreach ( $reset as &$arr ) { $arr[0]->setValue( $arr[1] ); } diff --git a/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php b/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php index 3d407fb..145ffb3 100644 --- a/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php +++ b/tests/phpunit/includes/specialpage/SpecialPageFactoryTest.php @@ -1,4 +1,6 @@ <?php +use Wikimedia\ScopedCallback; + /** * Factory for handling the special page list and generating SpecialPage objects. * diff --git a/tests/phpunit/includes/user/BotPasswordTest.php b/tests/phpunit/includes/user/BotPasswordTest.php index cb27fde..81c84e8 100644 --- a/tests/phpunit/includes/user/BotPasswordTest.php +++ b/tests/phpunit/includes/user/BotPasswordTest.php @@ -1,6 +1,7 @@ <?php use MediaWiki\Session\SessionManager; +use Wikimedia\ScopedCallback; /** * @covers BotPassword diff --git a/tests/phpunit/suites/ParserTestTopLevelSuite.php b/tests/phpunit/suites/ParserTestTopLevelSuite.php index 4284a77..5a7fc48 100644 --- a/tests/phpunit/suites/ParserTestTopLevelSuite.php +++ b/tests/phpunit/suites/ParserTestTopLevelSuite.php @@ -1,4 +1,5 @@ <?php +use Wikimedia\ScopedCallback; /** * The UnitTest must be either a class that inherits from MediaWikiTestCase -- To view, visit https://gerrit.wikimedia.org/r/315465 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Anomie <bjor...@wikimedia.org> Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Tpt <thoma...@hotmail.fr> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits