public function getContext() {
if ( $this->context === null ) {
$class = get_class( $this );
- wfDebug( __METHOD__ . " ($class): called and \$context is null. Using RequestContext::getMain() for sanity\n" );
+ wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
+ "Using RequestContext::getMain() for sanity\n" );
$this->context = RequestContext::getMain();
}
+
return $this->context;
}
*/
public function getLang() {
wfDeprecated( __METHOD__, '1.19' );
+
return $this->getLanguage();
}
*/
public function msg( /* $args */ ) {
$args = func_get_args();
+
return call_user_func_array( array( $this->getContext(), 'msg' ), $args );
}
global $wgRequest; # fallback to $wg till we can improve this
$this->request = $wgRequest;
}
+
return $this->request;
}
* Set the Title object
*
* @param Title $t
+ * @throws MWException
*/
public function setTitle( $t ) {
if ( $t !== null && !$t instanceof Title ) {
global $wgTitle; # fallback to $wg till we can improve this
$this->title = $wgTitle;
}
+
return $this->title;
}
}
$this->wikipage = WikiPage::factory( $title );
}
+
return $this->wikipage;
}
if ( $this->output === null ) {
$this->output = new OutputPage( $this );
}
+
return $this->output;
}
if ( $this->user === null ) {
$this->user = User::newFromSession( $this->getRequest() );
}
+
return $this->user;
}
*/
public function getLang() {
wfDeprecated( __METHOD__, '1.19' );
+
return $this->getLanguage();
}
$this->skin->setContext( $this );
wfProfileOut( __METHOD__ . '-createskin' );
}
+
return $this->skin;
}
*/
public function msg() {
$args = func_get_args();
+
return call_user_func_array( 'wfMessage', $args )->setContext( $this );
}
if ( $instance === null ) {
$instance = new self;
}
+
return $instance;
}
$user = User::newFromName( $params['ip'], false );
}
- $importSessionFunction = function( User $user, array $params ) {
+ $importSessionFunction = function ( User $user, array $params ) {
global $wgRequest, $wgUser;
$context = RequestContext::getMain();
$importSessionFunction( $user, $params );
// Set callback to save and close the new session and reload the old one
- return new ScopedCallback( function() use ( $importSessionFunction, $oUser, $oParams ) {
+ return new ScopedCallback( function () use ( $importSessionFunction, $oUser, $oParams ) {
$importSessionFunction( $oUser, $oParams );
} );
}
$context->setRequest( new FauxRequest( $request ) );
}
$context->user = User::newFromName( '127.0.0.1', false );
+
return $context;
}
}