A service for read-only mode
authorTim Starling <tstarling@wikimedia.org>
Mon, 10 Apr 2017 05:34:30 +0000 (15:34 +1000)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 19 Apr 2017 19:27:06 +0000 (12:27 -0700)
commit820f46964f7968a8f534a678dc528348445b666d
treeb26918f075d9c83c1ea68308b36ed4d2da306735
parent0a873ed202207e3ab14e6ff372d7c0e9e0c95ea5
A service for read-only mode

Introduce a service to represent wfReadOnly() and friends.

It's necessary to have two service instances, one for wfReadOnly() and
one for wfConfiguredReadOnlyReason(), to avoid a circular dependency,
since LoadBalancer needs the configured reason during construction, but
wfReadOnly() needs to query the currently active load balancer.

Not having a cache of the configuration makes it possible to dynamically
change the configuration. Ideally things would not change the
configuration, and I removed such instances in core, but to support
extensions, I added a test ensuring that the configuration can be changed.

Change-Id: I9bbee946c10742526d3423208efd68cb3cc5a7ee
13 files changed:
autoload.php
includes/GlobalFunctions.php
includes/MediaWikiServices.php
includes/ReadOnlyMode.php [new file with mode: 0644]
includes/ServiceWiring.php
includes/WatchedItemStore.php
includes/db/MWLBFactory.php
maintenance/rebuildFileCache.php
maintenance/rebuildImages.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/ReadOnlyModeTest.php [new file with mode: 0644]
tests/phpunit/includes/WatchedItemStoreUnitTest.php
tests/phpunit/includes/auth/AuthManagerTest.php