Allow reset of global services (redux).
authordaniel <daniel.kinzler@wikimedia.de>
Sun, 1 May 2016 19:29:11 +0000 (21:29 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Wed, 4 May 2016 17:18:29 +0000 (19:18 +0200)
commitd7410db0fdf99dab9dcd4244e608383016e2dfb1
tree8ea9dbdfcac6bf0367f6cc16f568e751558720b6
parentfbe9167b89baa2edb42eb1367aa860bb2d10cdba
Allow reset of global services (redux).

(This is part of I6ec374ac9 wich was a re-submit of Ie98bf5af5
which got reverted by Ide7ab563)

This change provides a mechanism to reset global service instances
in an orderly manner. There are three use cases for this:

* the installation process
* integration tests (which most of the existing phpunit tests are)

In contrast to I6ec374ac9, this change does not cause singeltons
of legacy services to be reset. It is assumed that legacy services
use global state to access services and configuration, so any
change in confuguration would affect them immediately.

NOTE: the original I6ec374ac9 would cause session information to
get lost if the user session was creatsed before initialization
was complete. This was apparently triggered by the MobileFrontend
extension under some circumstances. Check with Addshore and Catrope.

Change-Id: Ie06782ffb96e675c0aa55dc26fb8f22037e8517d
24 files changed:
autoload.php
docs/hooks.txt
docs/injection.txt
includes/GlobalFunctions.php
includes/MediaWikiServices.php
includes/ServiceWiring.php
includes/Services/CannotReplaceActiveServiceException.php [new file with mode: 0644]
includes/Services/ContainerDisabledException.php [new file with mode: 0644]
includes/Services/DestructibleService.php [new file with mode: 0644]
includes/Services/NoSuchServiceException.php [new file with mode: 0644]
includes/Services/ServiceAlreadyDefinedException.php [new file with mode: 0644]
includes/Services/ServiceContainer.php
includes/Services/ServiceDisabledException.php [new file with mode: 0644]
includes/Setup.php
includes/config/ConfigFactory.php
includes/db/loadbalancer/LBFactory.php
includes/db/loadbalancer/LoadBalancer.php
includes/installer/DatabaseInstaller.php
includes/installer/Installer.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/MediaWikiServicesTest.php
tests/phpunit/includes/Services/ServiceContainerTest.php
tests/phpunit/includes/config/ConfigFactoryTest.php
tests/phpunit/phpunit.php