(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
43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
namespace MediaWiki\Services;
|
|
|
|
use Exception;
|
|
use RuntimeException;
|
|
|
|
/**
|
|
* Exception thrown when trying to access a disabled service.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
*
|
|
* @file
|
|
*
|
|
* @since 1.27
|
|
*/
|
|
|
|
/**
|
|
* Exception thrown when trying to access a disabled service.
|
|
*/
|
|
class ServiceDisabledException extends RuntimeException {
|
|
|
|
/**
|
|
* @param string $serviceName
|
|
* @param Exception|null $previous
|
|
*/
|
|
public function __construct( $serviceName, Exception $previous = null ) {
|
|
parent::__construct( "Service disabled: $serviceName", 0, $previous );
|
|
}
|
|
|
|
}
|