[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
Request-dependant objects containers. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Author: | Alexandre Emsenhuber |
Author: | Daniel Friesen |
File Size: | 568 lines (15 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
RequestContext:: (25 methods):
setConfig()
getConfig()
setRequest()
getRequest()
setTitle()
getTitle()
canUseWikiPage()
setWikiPage()
getWikiPage()
setOutput()
getOutput()
setUser()
getUser()
sanitizeLangCode()
setLanguage()
getLanguage()
setSkin()
getSkin()
msg()
getMain()
getMainAndWarn()
resetMain()
exportSession()
importScopedSession()
newExtraneousContext()
Class: RequestContext - X-Ref
Group all the pieces relevant to the context of a request into one instancesetConfig( Config $c ) X-Ref |
Set the Config object param: Config $c |
getConfig() X-Ref |
Get the Config object return: Config |
setRequest( WebRequest $r ) X-Ref |
Set the WebRequest object param: WebRequest $r |
getRequest() X-Ref |
Get the WebRequest object return: WebRequest |
setTitle( Title $title ) X-Ref |
Set the Title object param: Title $title |
getTitle() X-Ref |
Get the Title object return: Title|null |
canUseWikiPage() X-Ref |
Check whether a WikiPage object can be get with getWikiPage(). Callers should expect that an exception is thrown from getWikiPage() if this method returns false. return: bool |
setWikiPage( WikiPage $p ) X-Ref |
Set the WikiPage object param: WikiPage $p |
getWikiPage() X-Ref |
Get the WikiPage object. May throw an exception if there's no Title object set or the Title object belongs to a special namespace that doesn't have WikiPage, so use first canUseWikiPage() to check whether this method can be called safely. return: WikiPage |
setOutput( OutputPage $o ) X-Ref |
param: OutputPage $o |
getOutput() X-Ref |
Get the OutputPage object return: OutputPage |
setUser( User $u ) X-Ref |
Set the User object param: User $u |
getUser() X-Ref |
Get the User object return: User |
sanitizeLangCode( $code ) X-Ref |
Accepts a language code and ensures it's sane. Outputs a cleaned up language code and replaces with $wgLanguageCode if not sane. param: string $code Language code return: string |
setLanguage( $l ) X-Ref |
Set the Language object param: Language|string $l Language instance or language code |
getLanguage() X-Ref |
Get the Language object. Initialization of user or request objects can depend on this. return: Language |
setSkin( Skin $s ) X-Ref |
Set the Skin object param: Skin $s |
getSkin() X-Ref |
Get the Skin object return: Skin |
msg() X-Ref |
Get a Message object with context set Parameters are the same as wfMessage() return: Message |
getMain() X-Ref |
Get the RequestContext object associated with the main request return: RequestContext |
getMainAndWarn( $func = __METHOD__ ) X-Ref |
Get the RequestContext object associated with the main request and gives a warning to the log, to find places, where a context maybe is missing. param: string $func return: RequestContext |
resetMain() X-Ref |
Resets singleton returned by getMain(). Should be called only from unit tests. |
exportSession() X-Ref |
Export the resolved user IP, HTTP headers, user ID, and session ID. The result will be reasonably sized to allow for serialization. return: array |
importScopedSession( array $params ) X-Ref |
Import the resolved user IP, HTTP headers, user ID, and session ID. This sets the current session and sets $wgUser and $wgRequest. Once the return value falls out of scope, the old context is restored. This function can only be called within CLI mode scripts. This will setup the session from the given ID. This is useful when background scripts inherit context when acting on behalf of a user. param: array $params Result of RequestContext::exportSession() return: ScopedCallback |
newExtraneousContext( Title $title, $request = array() X-Ref |
Create a new extraneous context. The context is filled with information external to the current session. - Title is specified by argument - Request is a FauxRequest, or a FauxRequest can be specified by argument - User is an anonymous user, for separation IPv4 localhost is used - Language will be based on the anonymous user and request, may be content language or a uselang param in the fauxrequest data may change the lang - Skin will be based on the anonymous user, should be the wiki's default skin param: Title $title Title to use for the extraneous request param: WebRequest|array $request A WebRequest or data to use for a FauxRequest return: RequestContext |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |