50 parent::__construct(
'Redirect' );
61 $parts = explode(
'/', $subpage, 2 );
62 $this->mType = count( $parts ) > 0 ? $parts[0] :
null;
63 $this->mValue = count( $parts ) > 1 ? $parts[1] :
null;
72 if ( !ctype_digit( $this->mValue ) ) {
75 $user = User::newFromId( (
int)$this->mValue );
77 if (
$user->isAnon() ) {
98 if ( !$file || !$file->exists() ) {
102 $url = $file->getUrl();
104 $width =
$request->getInt(
'width', -1 );
105 $height =
$request->getInt(
'height', -1 );
108 if ( $width != -1 ) {
109 $mto = $file->transform( [
'width' => $width,
'height' => $height ] );
111 if ( $mto && !$mto->isError() ) {
113 $url = $mto->getUrl();
128 if ( !ctype_digit( $oldid ) ) {
131 $oldid = (int)$oldid;
132 if ( $oldid === 0 ) {
148 if ( !ctype_digit( $curid ) ) {
151 $curid = (int)$curid;
152 if ( $curid === 0 ) {
170 if ( !ctype_digit( $logid ) ) {
173 $logid = (int)$logid;
174 if ( $logid === 0 ) {
189 $inner =
$dbr->selectSQLText(
192 [
'log_id' => $logid ]
197 $logsSameTimestamps =
$dbr->select(
200 [
"log_timestamp = ($inner)" ]
202 if ( $logsSameTimestamps->numRows() === 0 ) {
208 foreach ( $logsSameTimestamps
as $row ) {
209 if ( (
int)$row->log_id === $logid ) {
214 array_shift( $logparams );
218 foreach ( $logparams
as $cond ) {
220 foreach ( $logsSameTimestamps
as $row ) {
221 if ( $row->$cond === $rowMain->$cond ) {
222 $matchedRows[] = $row;
225 if ( count( $matchedRows ) === 1 ) {
228 $logsSameTimestamps = $matchedRows;
230 $query = [
'title' =>
'Special:Log',
'limit' => count( $matchedRows ) ];
234 'log_timestamp' =>
'offset',
235 'log_type' =>
'type',
236 'log_user_text' =>
'user'
239 foreach ( $logparams
as $logKey ) {
258 switch ( $this->mType ) {
283 if ( !is_null( $this->mValue ) ) {
284 $this->
getOutput()->setStatusCode( 404 );
288 return Status::newFatal( $msg );
300 'user' => $mp .
'-user',
301 'page' => $mp .
'-page',
302 'revision' => $mp .
'-revision',
303 'file' => $mp .
'-file',
304 'logid' => $mp .
'-logid',
309 'label-message' => $mp .
'-lookup',
311 'default' => current( array_keys( $ns ) ),
313 foreach ( $ns
as $n => $m ) {
314 $m = $this->
msg( $m )->text();
315 $a[
'type'][
'options'][$m] = $n;
319 'label-message' => $mp .
'-value'
322 if ( !empty( $this->mType ) ) {
325 if ( !empty( $this->mValue ) ) {
333 if ( !empty( $data[
'type'] ) && !empty( $data[
'value'] ) ) {
334 $this->
setParameter( $data[
'type'] .
'/' . $data[
'value'] );
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfFindFile( $title, $options=[])
Find a file.
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Special page which uses an HTMLForm to handle processing.
getMessagePrefix()
Get message prefix for HTMLForm.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
getOutput()
Get the OutputPage being used for this instance.
getRequest()
Get the WebRequest being used for this instance.
msg()
Wrapper around wfMessage that sets the current context.
A special page that redirects to: the user for a numeric user id, the file for a given filename,...
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
setParameter( $subpage)
Set $mType and $mValue based on parsed value of $subpage.
onSubmit(array $data)
Process the form on POST submission.
getDisplayFormat()
Get display format for the form.
dispatchLog()
Handle Special:Redirect/logid/xxx (by redirecting to index.php?title=Special:Log)
getFormFields()
Get an HTMLForm descriptor array.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
dispatchUser()
Handle Special:Redirect/user/xxxx (by redirecting to User:YYYY)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
dispatch()
Use appropriate dispatch* method to obtain a redirection URL, and either: redirect,...
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
dispatchRevision()
Handle Special:Redirect/revision/xxx (by redirecting to index.php?oldid=xxx)
$mValue
The identifier/value for the redirect (which id, which file)
dispatchPage()
Handle Special:Redirect/page/xxx (by redirecting to index.php?curid=xxx)
dispatchFile()
Handle Special:Redirect/file/xxxx.
$mType
The type of the redirect (user/file/revision)
Represents a title within MediaWiki.
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
the array() calling protocol came about after MediaWiki 1.4rc1.
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 local account $user
namespace and then decline to actually register it file or subcat img or subcat $title
error also a ContextSource you ll probably need to make sure the header is varied on $request
this hook is for auditing only or null if authentication failed before getting that far $username
null for the local 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
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