Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ReadOnlyError
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3 * @license GPL-2.0-or-later
4 * @file
5 */
6
7namespace MediaWiki\Exception;
8
9use MediaWiki\MediaWikiServices;
10
11/**
12 * Show an error when the wiki is locked/read-only and the user tries to do
13 * something that requires write access.
14 *
15 * @newable
16 * @since 1.18
17 * @ingroup Exception
18 */
19class ReadOnlyError extends ErrorPageError {
20
21    /**
22     * @stable to call
23     */
24    public function __construct() {
25        $reason = MediaWikiServices::getInstance()->getReadOnlyMode()->getReason();
26        parent::__construct(
27            'readonly',
28            'readonlytext',
29            $reason ? [ $reason ] : []
30        );
31    }
32}
33
34/** @deprecated class alias since 1.44 */
35class_alias( ReadOnlyError::class, 'ReadOnlyError' );