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 ) ) {
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 );
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'] );
dispatchRevision()
Handle Special:Redirect/revision/xxx (by redirecting to index.php?oldid=xxx)
dispatchPage()
Handle Special:Redirect/page/xxx (by redirecting to index.php?curid=xxx)
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
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
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
wfScript($script= 'index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
static newFatal($message)
Factory function for fatal errors.
dispatch()
Use appropriate dispatch* method to obtain a redirection URL, and either: redirect, set a 404 error code and error message, or do nothing (if $mValue wasn't set) allowing the form to be displayed.
static newFromId($id)
Static factory method for creation from a given user ID.
$mValue
The identifier/value for the redirect (which id, which file)
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
Special page which uses an HTMLForm to handle processing.
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
wfAppendQuery($url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
alterForm(HTMLForm $form)
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
namespace and then decline to actually register it file or subcat img or subcat $title
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
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
dispatchUser()
Handle Special:Redirect/user/xxxx (by redirecting to User:YYYY)
getMessagePrefix()
Get message prefix for HTMLForm.
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
this hook is for auditing only or null if authentication failed before getting that far $username
error also a ContextSource you ll probably need to make sure the header is varied on $request
A special page that redirects to: the user for a numeric user id, the file for a given filename...
dispatchLog()
Handle Special:Redirect/logid/xxx (by redirecting to index.php?title=Special:Log) ...
getRequest()
Get the WebRequest being used for this instance.
setParameter($subpage)
Set $mType and $mValue based on parsed value of $subpage.
wfFindFile($title, $options=[])
Find a file.
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
dispatchFile()
Handle Special:Redirect/file/xxxx.
$mType
The type of the redirect (user/file/revision)