Go to the documentation of this file.
86 if ( $this->config ===
null ) {
110 if ( $this->
request ===
null ) {
111 global $wgRequest; # fallback to $wg till we can improve
this
125 if (
$t !==
null && !
$t instanceof
Title ) {
126 throw new MWException( __METHOD__ .
" expects an instance of Title" );
130 $this->wikipage =
null;
139 if ( $this->
title ===
null ) {
156 if ( $this->wikipage !==
null ) {
157 # If there's a WikiPage object set, we can for sure get it
161 if ( $title ===
null ) {
162 # No Title, no WikiPage
165 # Only namespaces whose pages are stored in the database can have WikiPage
179 if ( !$contextTitle || !$pageTitle->equals( $contextTitle ) ) {
183 $this->wikipage = $p;
197 if ( $this->wikipage ===
null ) {
199 if ( $title ===
null ) {
200 throw new MWException( __METHOD__ .
' called without Title object set' );
221 if ( $this->
output ===
null ) {
243 if ( $this->
user ===
null ) {
260 $code = strtolower( $code );
264 wfDebug(
"Invalid user language code\n" );
265 $code = $wgLanguageCode;
277 public function setLang( $l ) {
292 } elseif ( is_string( $l ) ) {
297 throw new MWException( __METHOD__ .
" was passed an invalid type of data." );
319 if ( isset( $this->recursion ) ) {
320 trigger_error(
"Recursion detected in " . __METHOD__, E_USER_WARNING );
322 wfDebugLog(
'recursion-guard',
"Recursion detected:\n" .
$e->getTraceAsString() );
325 $code = ( $wgLanguageCode ) ? $wgLanguageCode :
'en';
327 } elseif ( $this->lang ===
null ) {
328 $this->recursion =
true;
340 if ( $code === $wgLanguageCode ) {
347 unset( $this->recursion );
369 if ( $this->
skin ===
null ) {
378 } elseif ( is_string(
$skin ) ) {
384 if ( $this->
skin ===
null ) {
386 if ( !in_array(
'skin', $wgHiddenPrefs ) ) {
388 $userSkin = $this->
getUser()->getOption(
'skin' );
389 $userSkin = $this->
getRequest()->getVal(
'useskin', $userSkin );
391 # if we're not allowing users to override, then use the default
393 $userSkin = $wgDefaultSkin;
415 public function msg() {
416 $args = func_get_args();
418 return call_user_func_array(
'wfMessage',
$args )->setContext( $this );
428 public static function getMain() {
429 static $instance =
null;
430 if ( $instance ===
null ) {
431 $instance =
new self;
447 'headers' => $this->
getRequest()->getAllHeaders(),
448 'sessionId' => session_id(),
449 'userId' => $this->
getUser()->getId()
470 if ( PHP_SAPI !==
'cli' ) {
472 throw new MWException(
"Sessions can only be imported in cli mode." );
473 } elseif ( !strlen(
$params[
'sessionId'] ) ) {
474 throw new MWException(
"No session ID was specified." );
480 throw new MWException(
"No user with ID '{$params['userId']}'." );
483 throw new MWException(
"Could not load user '{$params['ip']}'." );
493 session_write_close();
498 $wgRequest = $context->getRequest();
503 $context->setUser(
$user );
505 if ( strlen(
$params[
'sessionId'] ) ) {
515 $wgRequest = $context->getRequest();
524 return new ScopedCallback(
function () use ( $importSessionFunction, $oUser, $oParams ) {
525 $importSessionFunction( $oUser, $oParams );
545 $context->setTitle(
$title );
WebRequest clone which takes values from a provided array.
static newFromId( $id)
Static factory method for creation from a given user ID.
static sanitizeLangCode( $code)
Accepts a language code and ensures it's sane.
setLang( $l)
Set the Language object.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
setUser(User $u)
Set the User object.
wfSetupSession( $sessionId=false)
Initialise php session.
setConfig(Config $c)
Set the Config object.
static newFromSession(WebRequest $request=null)
Create a new user object using data from session or cookies.
wfDebugLog( $logGroup, $text, $dest='all')
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfProfileIn( $functionname)
Begin profiling of a function.
getRequest()
Get the WebRequest object.
Class representing a MediaWiki article and history.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
getUser()
Get the User object.
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Interface for configuration instances.
setTitle( $t)
Set the Title object.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
getWikiPage()
Get the WikiPage object.
getConfig()
Get the Config object.
getTitle()
Get the title object of the article.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
setSkin(Skin $s)
Set the Skin object.
static newExtraneousContext(Title $title, $request=array())
Create a new extraneous context.
static getDefaultInstance()
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
Group all the pieces relevant to the context of a request into one instance.
canExist()
Is this in a namespace that allows actual pages?
getLanguage()
Get the Language object.
setContext(IContextSource $context)
Set the IContextSource object.
This class should be covered by a general architecture document which does not exist as of January 20...
Class for asserting that a callback happens when an dummy object leaves scope.
getSkin()
Get the Skin object.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Allows to change the fields on the form that will be generated $name
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a skin(according to that user 's preference)
setWikiPage(WikiPage $p)
Set the WikiPage object.
getOption( $oname, $defaultOverride=null, $ignoreHidden=false)
Get the user's current setting for a given option.
getTitle()
Get the Title object.
static getMain()
Static methods.
static isValid( $ip)
Validate an IP address.
static isValidCode( $code)
Returns true if a language code string is of a valid form, whether or not it exists.
static importScopedSession(array $params)
Import the resolved user IP, HTTP headers, user ID, and session ID.
Interface for objects which can provide a context on request.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form,...
Represents a title within MediaWiki.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
getVal( $name, $default=null)
Fetch a scalar from the input or return $default if it's not set.
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
static factory( $code)
Get a cached or new language object for a given language code.
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
getOutput()
Get the OutputPage object.
The main skin class which provides methods and properties for all other skins.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LoginAuthenticateAudit' this hook is for auditing only etc create2 Corresponds to logging log_action database field and which is displayed in the UI similar to $comment this hook should only be used to add variables that depend on the current page request
setLanguage( $l)
Set the Language object.
Internationalisation code.
exportSession()
Export the resolved user IP, HTTP headers, user ID, and session ID.
static & newFromKey( $key)
Factory method for loading a skin of a given type.
if(! $wgRequest->checkUrlExtension()) if(! $wgEnableAPI) $wgTitle
setRequest(WebRequest $r)
Set the WebRequest object.