Go to the documentation of this file.
54 parent::__construct(
'Redirect' );
65 $parts = explode(
'/', $subpage, 2 );
66 $this->mType = $parts[0];
67 $this->mValue = $parts[1] ??
null;
76 if ( !ctype_digit( $this->mValue ) ) {
81 $username = $user->getName();
82 if ( $user->isAnon() ) {
86 if ( $user->isHidden() && !MediaWikiServices::getInstance()->getPermissionManager()
87 ->userHasRight( $this->
getUser(),
'hideuser' )
113 $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile(
$title );
120 $url =
$file->getUrl();
122 $width = $request->getInt(
'width', -1 );
123 $height = $request->getInt(
'height', -1 );
126 if ( $width != -1 ) {
127 $mto =
$file->transform( [
'width' => $width,
'height' => $height ] );
129 if ( $mto && !$mto->isError() ) {
133 $url = [ $mto->getUrl(), $height === -1 ? 301 : 302 ];
148 if ( !ctype_digit( $oldid ) ) {
152 $oldid = (int)$oldid;
153 if ( $oldid === 0 ) {
170 if ( !ctype_digit( $curid ) ) {
174 $curid = (int)$curid;
175 if ( $curid === 0 ) {
194 if ( !ctype_digit( $logid ) ) {
198 $logid = (int)$logid;
199 if ( $logid === 0 ) {
203 $query = [
'title' =>
'Special:Log',
'logid' => $logid ];
217 switch ( $this->mType ) {
241 if ( is_array( $value ) ) {
242 list( $url, $code ) = $value;
247 if ( $code === 301 ) {
248 $this->
getOutput()->setCdnMaxage( 60 * 60 );
252 $this->
getOutput()->redirect( $url, $code );
256 if ( !is_null( $this->mValue ) ) {
257 $this->
getOutput()->setStatusCode( 404 );
271 'user' => $mp .
'-user',
272 'page' => $mp .
'-page',
273 'revision' => $mp .
'-revision',
274 'file' => $mp .
'-file',
275 'logid' => $mp .
'-logid',
280 'label-message' => $mp .
'-lookup',
282 'default' => current( array_keys( $ns ) ),
284 foreach ( $ns as $n => $m ) {
285 $m = $this->
msg( $m )->text();
286 $a[
'type'][
'options'][$m] = $n;
290 'label-message' => $mp .
'-value'
293 if ( !empty( $this->mType ) ) {
296 if ( !empty( $this->mValue ) ) {
304 if ( !empty( $data[
'type'] ) && !empty( $data[
'value'] ) ) {
305 $this->
setParameter( $data[
'type'] .
'/' . $data[
'value'] );
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static newFromId( $id)
Static factory method for creation from a given user ID.
static makeName( $ns, $title, $fragment='', $interwiki='', $canonicalNamespace=false)
Make a prefixed DB key from a DB key and a namespace index.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
dispatchLog()
Handle Special:Redirect/logid/xxx (by redirecting to index.php?title=Special:Log&logid=xxx)
getOutput()
Get the OutputPage being used for this instance.
$mValue
The identifier/value for the redirect (which id, which file)
onSubmit(array $data)
Process the form on POST submission.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Special page which uses an HTMLForm to handle processing.
$mType
The type of the redirect (user/file/revision)
Show an error when a user tries to do something they do not have the necessary permissions for.
getDisplayFormat()
Get display format for the form.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
getMessagePrefix()
Get message prefix for HTMLForm.
A special page that redirects to: the user for a numeric user id, the file for a given filename,...
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
dispatch()
Use appropriate dispatch* method to obtain a redirection URL, and either: redirect,...
getFormFields()
Get an HTMLForm descriptor array.
getUser()
Shortcut to get the User executing this instance.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
dispatchRevision()
Handle Special:Redirect/revision/xxx (by redirecting to index.php?oldid=xxx)
static newFromTextThrow( $text, $defaultNamespace=NS_MAIN)
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid,...
static newGood( $value=null)
Factory function for good results.
dispatchFile()
Handle Special:Redirect/file/xxxx.
getRequest()
Get the WebRequest being used for this instance.
dispatchUser()
Handle Special:Redirect/user/xxxx (by redirecting to User:YYYY)
dispatchPage()
Handle Special:Redirect/page/xxx (by redirecting to index.php?curid=xxx)
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
setParameter( $subpage)
Set $mType and $mValue based on parsed value of $subpage.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...