This commit splits the existing Block class into AbstractBlock, Block and SystemBlock. Before this patch, the Block class represents several types of blocks, which can be separated into blocks stored in the database, and temporary blocks created by the system. These are now represented by Block and SystemBlock, which inherit from AbstractBlock. This lays the foundations for: * enforcing block parameters from multiple blocks that apply to a user/IP address * improvements to the Block API, including the addition of services Breaking changes: functions expecting a Block object should still expect a Block object if it came from the database, but other functions may now need to expect an AbstractBlock or SystemBlock object. (Note that an alternative naming scheme, in which the abstract class is called Block and the subclasses are DatabaseBlock and SystemBlock, avoids this breakage. However, it introduces more breakages to calls to static Block methods and new Block instantiations.) Changes to tests: system blocks don't set the $blockCreateAccount or $mExipry block properties, so remove/change any tests that assume they do. Bug: T222737 Change-Id: I83bceb5e5049e254c90ace060f8f8fad44696c67
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* 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
|
|
*/
|
|
|
|
use MediaWiki\Block\AbstractBlock;
|
|
|
|
/**
|
|
* Show an error when the user tries to do something whilst blocked.
|
|
*
|
|
* @since 1.18
|
|
* @ingroup Exception
|
|
*/
|
|
class UserBlockedError extends ErrorPageError {
|
|
public function __construct( AbstractBlock $block ) {
|
|
// @todo FIXME: Implement a more proper way to get context here.
|
|
$params = $block->getPermissionsError( RequestContext::getMain() );
|
|
parent::__construct( 'blockedtitle', array_shift( $params ), $params );
|
|
}
|
|
}
|