Go to the documentation of this file.
66 parent::__construct(
'Unblock',
'block' );
82 $this->block = DatabaseBlock::newFromTarget( $this->target );
83 if ( $this->target instanceof
User ) {
84 # Set the 'relevant user' in the skin, so it displays links like Contributions,
85 # User logs, UserRights, etc.
86 $this->
getSkin()->setRelevantUser( $this->target );
94 $out->setPageTitle( $this->
msg(
'unblockip' ) );
95 $out->addModules( [
'mediawiki.userSuggest' ] );
98 ->setWrapperLegendMsg(
'unblockip' )
99 ->setSubmitCallback(
function ( array $data,
HTMLForm $form ) {
100 return $this->unblockUserFactory->newUnblockUser(
107 ->setSubmitTextMsg(
'ipusubmit' )
108 ->addPreText( $this->
msg(
'unblockiptext' )->parseAsBlock() );
110 if ( $form->
show() ) {
111 switch ( $this->type ) {
112 case DatabaseBlock::TYPE_IP:
115 case DatabaseBlock::TYPE_USER:
118 case DatabaseBlock::TYPE_RANGE:
121 case DatabaseBlock::TYPE_ID:
122 case DatabaseBlock::TYPE_AUTO:
141 $request->
getVal(
'wpTarget',
null ),
143 $request->
getVal(
'ip',
null ),
145 $request->
getVal(
'wpBlockAddress',
null ),
147 foreach ( $possibleTargets as $possibleTarget ) {
148 $targetAndType = $this->blockUtils->parseBlockTarget( $possibleTarget );
150 if ( $targetAndType[ 1 ] !==
null ) {
154 return $targetAndType;
161 'label-message' =>
'ipaddressorusername',
165 'cssclass' =>
'mw-autocomplete-user',
169 'label-message' =>
'ipaddressorusername',
173 'label-message' =>
'ipbreason',
178 list(
$target,
$type ) = $this->block->getTargetAndType();
180 # Autoblocks are logged as "autoblock #123 because the IP was recently used by
181 # User:Foo, and we've just got any block, auto or not, that applies to a target
182 # the user has specified. Someone could be fishing to connect IPs to autoblocks,
183 # so don't show any distinction between unblocked IPs and autoblocked IPs
184 if (
$type == DatabaseBlock::TYPE_AUTO && $this->type == DatabaseBlock::TYPE_IP ) {
186 unset( $fields[
'Name'] );
188 $fields[
'Target'][
'default'] =
$target;
189 $fields[
'Target'][
'type'] =
'hidden';
191 case DatabaseBlock::TYPE_IP:
196 $fields[
'Name'][
'raw'] =
true;
198 case DatabaseBlock::TYPE_USER:
203 $fields[
'Name'][
'raw'] =
true;
206 case DatabaseBlock::TYPE_RANGE:
207 $fields[
'Name'][
'default'] =
$target;
210 case DatabaseBlock::TYPE_AUTO:
211 $fields[
'Name'][
'default'] = $this->block->getRedactedName();
212 $fields[
'Name'][
'raw'] =
true;
213 # Don't expose the real target of the autoblock
214 $fields[
'Target'][
'default'] =
"#{$this->target}";
218 $fields[
'Target'][
'autofocus'] =
false;
219 $fields[
'Reason'][
'autofocus'] =
true;
223 unset( $fields[
'Name'] );
240 if ( !isset( $data[
'Tags'] ) ) {
244 $unblockUser = MediaWikiServices::getInstance()->getUnblockUserFactory()->newUnblockUser(
251 $status = $unblockUser->unblock();
252 if ( !$status->isOK() ) {
253 return $status->getErrorsArray();
268 $search = $this->userNameUtils->getCanonical( $search );
274 return $this->userNamePrefixSearch
275 ->search( UserNamePrefixSearch::AUDIENCE_PUBLIC, $search, $limit, $offset );
static processUnblock(array $data, IContextSource $context)
Process the form.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getContext()
Get the base IContextSource object.
getTargetAndType(?string $par, WebRequest $request)
Get the target and type, given the request and the subpage parameter.
getOutput()
Get the OutputPage being used for this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getSkin()
Shortcut to get the skin being used for this instance.
UserNamePrefixSearch $userNamePrefixSearch
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that $function is deprecated.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
UserNameUtils $userNameUtils
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!...
getContext()
Gets the context this SpecialPage is executed in.
execute( $par)
Default execute method Checks user permissions.
Parent class for all special pages.
getRequest()
Get the WebRequest being used for this instance.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Interface for objects which can provide a MediaWiki context on request.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
getVal( $name, $default=null)
Fetch a scalar from the input or return $default if it's not set.
doesWrites()
Indicates whether this special page may perform database writes.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
A special page for unblocking users.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
__construct(UnblockUserFactory $unblockUserFactory, BlockUtils $blockUtils, UserNameUtils $userNameUtils, UserNamePrefixSearch $userNamePrefixSearch)
UnblockUserFactory $unblockUserFactory