[MediaWiki-commits] [Gerrit] Upgrade Pimple to 2.x - change (mediawiki...Flow)
jenkins-bot has submitted this change and it was merged. Change subject: Upgrade Pimple to 2.x .. Upgrade Pimple to 2.x There are two main things that this patch adjusts for: * The share method was deprecated and made the default action. The only thing we have that isn't shared is the RevisionFormatter. * Once we fetch a key from the container it is now marked frozen. That means we cannot fetch an object and then replace it. It also means we now have stronger guarantee's that the container's shared object model is consistent. This is version 2.1.1 of pimple which comes from refs/tags/v2.1.1 tag at https://github.com/silexphp/Pimple.git. The commit hash was ea22fb2880faf7b7b0e17c9809c6fe25b071fd76 Fixes T88321 Bug: T88321 Change-Id: I61dfb4feae8ea266cc6a43b455d8158c7888cb03 --- M autoload.php M container.php M includes/Actions/PurgeAction.php M includes/Container.php M includes/Content/BoardContentHandler.php M includes/Notifications/Formatter.php M includes/api/ApiFlowBase.php M tests/phpunit/PostRevisionTestCase.php D vendor/Pimple.php A vendor/Pimple/Container.php A vendor/Pimple/ServiceProviderInterface.php 11 files changed, 603 insertions(+), 480 deletions(-) Approvals: Mattflaschen: Looks good to me, approved jenkins-bot: Verified diff --git a/autoload.php b/autoload.php index 22730bf..1008f29 100644 --- a/autoload.php +++ b/autoload.php @@ -367,5 +367,5 @@ 'Flow\\WorkflowLoader' => __DIR__ . '/includes/WorkflowLoader.php', 'Flow\\WorkflowLoaderFactory' => __DIR__ . '/includes/WorkflowLoaderFactory.php', 'MaintenanceDebugLogger' => __DIR__ . '/maintenance/MaintenanceDebugLogger.php', - 'Pimple' => __DIR__ . '/vendor/Pimple.php', + 'Pimple\\Container' => __DIR__ . '/vendor/Pimple/Container.php', ); diff --git a/container.php b/container.php index 96cb206..aaddba2 100644 --- a/container.php +++ b/container.php @@ -10,86 +10,90 @@ } $c['output'] = $GLOBALS['wgOut']; $c['request'] = $GLOBALS['wgRequest']; -if ( $GLOBALS['wgFlowUseMemcache'] ) { - $c['memcache'] = $GLOBALS['wgMemc']; -} else { - $c['memcache'] = new \HashBagOStuff; -} +$c['memcache'] = function( $c ) { + global $wgFlowUseMemcache, $wgMemc; + + if ( $wgFlowUseMemcache ) { + return $wgMemc; + } else { + return new \HashBagOStuff(); + } +}; $c['cache.version'] = $GLOBALS['wgFlowCacheVersion']; // Flow config -$c['flow_actions'] = $c->share( function( $c ) { +$c['flow_actions'] = function( $c ) { global $wgFlowActions; return new Flow\FlowActions( $wgFlowActions ); -} ); +}; // Always returns the correct database for flow storage -$c['db.factory'] = $c->share( function( $c ) { +$c['db.factory'] = function( $c ) { global $wgFlowDefaultWikiDb, $wgFlowCluster; return new Flow\DbFactory( $wgFlowDefaultWikiDb, $wgFlowCluster ); -} ); +}; // Database Access Layer external from main implementation -$c['repository.tree'] = $c->share( function( $c ) { +$c['repository.tree'] = function( $c ) { global $wgFlowCacheTime; return new Flow\Repository\TreeRepository( $c['db.factory'], $c['memcache.buffered'] ); -} ); +}; -$c['url_generator'] = $c->share( function( $c ) { +$c['url_generator'] = function( $c ) { return new Flow\UrlGenerator(); -} ); +}; // listener is attached to storage.workflow, it // notifies the url generator about all loaded workflows. -$c['listener.url_generator'] = $c->share( function( $c ) { +$c['listener.url_generator'] = function( $c ) { return new Flow\Data\Listener\UrlGenerationListener( $c['url_generator'] ); -} ); +}; -$c['watched_items'] = $c->share( function( $c ) { +$c['watched_items'] = function( $c ) { return new Flow\WatchedTopicItems( $c['user'], wfGetDB( DB_SLAVE, 'watchlist' ) ); -} ); +}; -$c['link_batch'] = $c->share( function() { +$c['link_batch'] = function() { return new LinkBatch; -} ); +}; -$c['redlinker'] = $c->share( function( $c ) { +$c['redlinker'] = function( $c ) { return new Flow\Parsoid\Fixer\Redlinker( $c['link_batch'] ); -} ); +}; -$c['bad_image_remover'] = $c->share( function( $c ) { +$c['bad_image_remover'] = function( $c ) { return new Flow\Parsoid\Fixer\BadImageRemover( 'wfIsBadImage' ); -} ); +}; -$c['content_fixer'] = $c->share( function( $c ) { +$c['content_fixer'] = function( $c ) { return new Flow\Parsoid\ContentFixer( $c['redlinker'], $c['bad_image_remover'] ); -} ); +}; -$c['permissions'] = $c->share( function( $c ) { +$c['permissions'] = function( $c ) { return new Flow\RevisionActionPermissions( $c['flow_actions'], $c['user'] ); -} ); +}; $c['lightncandy.template_dir'] = __DIR__ . '/handlebars'; -$c['lightncandy'] = $c
[MediaWiki-commits] [Gerrit] Upgrade Pimple to 2.x - change (mediawiki...Flow)
EBernhardson has uploaded a new change for review. https://gerrit.wikimedia.org/r/192608 Change subject: Upgrade Pimple to 2.x .. Upgrade Pimple to 2.x There are two main things that this patch adjusts for: * The share method was deprecated and made the default action. The only thing we have that isn't shared is the RevisionFormatter. * Once we fetch a key from the container it is now marked frozen. That means we cannot fetch an object and then replace it. It also means we now have stronger guarantee's that the container's shared object model is consistent. Fixes T88321 Bug: T88321 Change-Id: I61dfb4feae8ea266cc6a43b455d8158c7888cb03 --- M autoload.php M container.php M includes/Actions/PurgeAction.php M includes/Container.php M includes/Content/BoardContentHandler.php M includes/Notifications/Formatter.php M includes/api/ApiFlowBase.php M tests/phpunit/PostRevisionTestCase.php D vendor/Pimple.php A vendor/Pimple/Container.php 10 files changed, 557 insertions(+), 480 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/08/192608/1 diff --git a/autoload.php b/autoload.php index 593efa1..1086ff9 100644 --- a/autoload.php +++ b/autoload.php @@ -367,5 +367,5 @@ 'Flow\\WorkflowLoader' => __DIR__ . '/includes/WorkflowLoader.php', 'Flow\\WorkflowLoaderFactory' => __DIR__ . '/includes/WorkflowLoaderFactory.php', 'MaintenanceDebugLogger' => __DIR__ . '/maintenance/MaintenanceDebugLogger.php', - 'Pimple' => __DIR__ . '/vendor/Pimple.php', + 'Pimple\\Container' => __DIR__ . '/vendor/Pimple/Container.php', ); diff --git a/container.php b/container.php index 39499b5..8fd1424 100644 --- a/container.php +++ b/container.php @@ -10,86 +10,90 @@ } $c['output'] = $GLOBALS['wgOut']; $c['request'] = $GLOBALS['wgRequest']; -if ( $GLOBALS['wgFlowUseMemcache'] ) { - $c['memcache'] = $GLOBALS['wgMemc']; -} else { - $c['memcache'] = new \HashBagOStuff; -} +$c['memcache'] = function( $c ) { + global $wgFlowUseMemcache, $wgMemc; + + if ( $wgFlowUseMemcache ) { + return $wgMemc; + } else { + return new \HashBagOStuff(); + } +}; $c['cache.version'] = $GLOBALS['wgFlowCacheVersion']; // Flow config -$c['flow_actions'] = $c->share( function( $c ) { +$c['flow_actions'] = function( $c ) { global $wgFlowActions; return new Flow\FlowActions( $wgFlowActions ); -} ); +}; // Always returns the correct database for flow storage -$c['db.factory'] = $c->share( function( $c ) { +$c['db.factory'] = function( $c ) { global $wgFlowDefaultWikiDb, $wgFlowCluster; return new Flow\DbFactory( $wgFlowDefaultWikiDb, $wgFlowCluster ); -} ); +}; // Database Access Layer external from main implementation -$c['repository.tree'] = $c->share( function( $c ) { +$c['repository.tree'] = function( $c ) { global $wgFlowCacheTime; return new Flow\Repository\TreeRepository( $c['db.factory'], $c['memcache.buffered'] ); -} ); +}; -$c['url_generator'] = $c->share( function( $c ) { +$c['url_generator'] = function( $c ) { return new Flow\UrlGenerator(); -} ); +}; // listener is attached to storage.workflow, it // notifies the url generator about all loaded workflows. -$c['listener.url_generator'] = $c->share( function( $c ) { +$c['listener.url_generator'] = function( $c ) { return new Flow\Data\Listener\UrlGenerationListener( $c['url_generator'] ); -} ); +}; -$c['watched_items'] = $c->share( function( $c ) { +$c['watched_items'] = function( $c ) { return new Flow\WatchedTopicItems( $c['user'], wfGetDB( DB_SLAVE, 'watchlist' ) ); -} ); +}; -$c['link_batch'] = $c->share( function() { +$c['link_batch'] = function() { return new LinkBatch; -} ); +}; -$c['redlinker'] = $c->share( function( $c ) { +$c['redlinker'] = function( $c ) { return new Flow\Parsoid\Fixer\Redlinker( $c['link_batch'] ); -} ); +}; -$c['bad_image_remover'] = $c->share( function( $c ) { +$c['bad_image_remover'] = function( $c ) { return new Flow\Parsoid\Fixer\BadImageRemover( 'wfIsBadImage' ); -} ); +}; -$c['content_fixer'] = $c->share( function( $c ) { +$c['content_fixer'] = function( $c ) { return new Flow\Parsoid\ContentFixer( $c['redlinker'], $c['bad_image_remover'] ); -} ); +}; -$c['permissions'] = $c->share( function( $c ) { +$c['permissions'] = function( $c ) { return new Flow\RevisionActionPermissions( $c['flow_actions'], $c['user'] ); -} ); +}; $c['lightncandy.template_dir'] = __DIR__ . '/handlebars'; -$c['lightncandy'] = $c->share( function( $c ) { +$c['lightncandy'] = function( $c ) { global $wgFlowServerCompileTemplates; return new Flow\TemplateHelper( $