* @ingroup SpecialPage
*/
-use MediaWiki\Block\BlockRestriction;
use MediaWiki\Block\Restriction\PageRestriction;
use MediaWiki\Block\Restriction\NamespaceRestriction;
+use MediaWiki\MediaWikiServices;
/**
* A special page that allows users with 'block' right to block users from
$currentBlock->isSitewide( $block->isSitewide() );
// Set the block id of the restrictions.
+ $blockRestrictionStore = MediaWikiServices::getInstance()->getBlockRestrictionStore();
$currentBlock->setRestrictions(
- BlockRestriction::setBlockId( $currentBlock->getId(), $restrictions )
+ $blockRestrictionStore->setBlockId( $currentBlock->getId(), $restrictions )
);
}
*
* @todo strtotime() only accepts English strings. This means the expiry input
* can only be specified in English.
- * @see https://secure.php.net/manual/en/function.strtotime.php
+ * @see https://www.php.net/manual/en/function.strtotime.php
*
* @param string $expiry Whatever was typed into the form
* @return string|bool Timestamp or 'infinity' or false on error.
} elseif ( is_string( $target ) ) {
$target = User::newFromName( $target );
}
- if ( $performer->isBlocked() ) {
+ if ( $performer->getBlock() ) {
if ( $target instanceof User && $target->getId() == $performer->getId() ) {
# User is trying to unblock themselves
+ // @TODO Ensure that the block does not apply to the `unblockself`
+ // right.
if ( $performer->isAllowed( 'unblockself' ) ) {
return true;
# User blocked themselves and is now trying to reverse it