Go to the documentation of this file.
52 parent::__construct(
'Redirect' );
63 $parts = explode(
'/', $subpage, 2 );
64 $this->mType =
count( $parts ) > 0 ? $parts[0] :
null;
65 $this->mValue =
count( $parts ) > 1 ? $parts[1] :
null;
74 if ( !ctype_digit( $this->mValue ) ) {
79 if (
$user->isAnon() ) {
100 if ( !$file || !$file->exists() ) {
104 $url = $file->getUrl();
106 $width =
$request->getInt(
'width', -1 );
107 $height =
$request->getInt(
'height', -1 );
110 if ( $width != -1 ) {
111 $mto = $file->transform( [
'width' => $width,
'height' => $height ] );
113 if ( $mto && !$mto->isError() ) {
115 $url = $mto->getUrl();
130 if ( !ctype_digit( $oldid ) ) {
133 $oldid = (int)$oldid;
134 if ( $oldid === 0 ) {
150 if ( !ctype_digit( $curid ) ) {
153 $curid = (int)$curid;
154 if ( $curid === 0 ) {
172 if ( !ctype_digit( $logid ) ) {
175 $logid = (int)$logid;
176 if ( $logid === 0 ) {
191 $inner =
$dbr->selectSQLText(
194 [
'log_id' => $logid ]
199 $logsSameTimestamps =
$dbr->select(
202 [
"log_timestamp = ($inner)" ]
204 if ( $logsSameTimestamps->numRows() === 0 ) {
210 foreach ( $logsSameTimestamps
as $row ) {
211 if ( (
int)$row->log_id === $logid ) {
216 array_shift( $logparams );
220 foreach ( $logparams
as $cond ) {
222 foreach ( $logsSameTimestamps
as $row ) {
223 if ( $row->$cond === $rowMain->$cond ) {
224 $matchedRows[] = $row;
227 if (
count( $matchedRows ) === 1 ) {
230 $logsSameTimestamps = $matchedRows;
232 $query = [
'title' =>
'Special:Log',
'limit' =>
count( $matchedRows ) ];
236 'log_timestamp' =>
'offset',
237 'log_type' =>
'type',
238 'log_user_text' =>
'user'
241 foreach ( $logparams
as $logKey ) {
260 switch ( $this->mType ) {
285 if ( !is_null( $this->mValue ) ) {
286 $this->
getOutput()->setStatusCode( 404 );
302 'user' => $mp .
'-user',
303 'page' => $mp .
'-page',
304 'revision' => $mp .
'-revision',
305 'file' => $mp .
'-file',
306 'logid' => $mp .
'-logid',
311 'label-message' => $mp .
'-lookup',
313 'default' => current( array_keys( $ns ) ),
315 foreach ( $ns
as $n => $m ) {
316 $m = $this->
msg( $m )->text();
317 $a[
'type'][
'options'][$m] = $n;
321 'label-message' => $mp .
'-value'
324 if ( !empty( $this->mType ) ) {
327 if ( !empty( $this->mValue ) ) {
335 if ( !empty( $data[
'type'] ) && !empty( $data[
'value'] ) ) {
336 $this->
setParameter( $data[
'type'] .
'/' . $data[
'value'] );
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
static newFromId( $id)
Static factory method for creation from a given user ID.
msg( $key)
Wrapper around wfMessage that sets the current context.
dispatchLog()
Handle Special:Redirect/logid/xxx (by redirecting to index.php?title=Special:Log)
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...
static newFatal( $message)
Factory function for fatal errors.
Special page which uses an HTMLForm to handle processing.
$mType
The type of the redirect (user/file/revision)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
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,...
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
namespace and then decline to actually register it file or subcat img or subcat $title
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
dispatch()
Use appropriate dispatch* method to obtain a redirection URL, and either: redirect,...
getFormFields()
Get an HTMLForm descriptor array.
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)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
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)
wfFindFile( $title, $options=[])
Find a file.
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.
Represents a title within MediaWiki.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
setParameter( $subpage)
Set $mType and $mValue based on parsed value of $subpage.
this hook is for auditing only or null if authentication failed before getting that far $username
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
the array() calling protocol came about after MediaWiki 1.4rc1.