*/
function __construct( RequestContext $context = null ) {
if ( !isset($context) ) {
+var_dump('foo');
# Extensions should use `new RequestContext` instead of `new OutputPage` now.
wfDeprecated( __METHOD__ );
}
}
if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
- $out = new OutputPage;
- $out->setUser( $wgUser );
- $out->addParserOutputNoText( $p_result );
- $userSkin = $wgUser->getSkin();
+ $context = new RequestContext;
+ $context->output->addParserOutputNoText( $p_result );
if ( isset( $prop['headitems'] ) ) {
$headItems = $this->formatHeadItems( $p_result->getHeadItems() );
- $userSkin->setupUserCss( $out );
- $css = $this->formatCss( $out->buildCssLinksArray() );
+ $context->skin->setupUserCss( $context->output );
+ $css = $this->formatCss( $context->output->buildCssLinksArray() );
- $scripts = array( $out->getHeadScripts( $userSkin ) );
+ $scripts = array( $context->output->getHeadScripts( $context->skin ) );
$result_array['headitems'] = array_merge( $headItems, $css, $scripts );
}
if ( isset( $prop['headhtml'] ) ) {
$result_array['headhtml'] = array();
- $result->setContent( $result_array['headhtml'], $out->headElement( $userSkin ) );
+ $result->setContent( $result_array['headhtml'], $context->output->headElement( $context->skin ) );
}
}
foreach ( $res as $row ) {
$rebuilt = false;
$wgRequestTime = wfTime(); # bug 22852
+ $context = new RequestContext;
$wgTitle = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
+ $context->setTitle( $wgTitle );
if ( null == $wgTitle ) {
$this->output( "Page {$row->page_id} has bad title\n" );
continue; // broken title?
}
- $wgOut->setTitle( $wgTitle ); // set display title
+ $wgOut = $context->output; // set display title
$wgUser->getSkin( $wgTitle ); // set skin title
$wgArticle = new Article( $wgTitle );
// If the article is cacheable, then load it
@$wgOut->output(); // header notices
$wgUseFileCache = true;
ob_end_clean(); // clear buffer
- $wgOut = new OutputPage(); // empty out any output page garbage
if ( $rebuilt )
$this->output( "Re-cached page {$row->page_id}\n" );
else
$GLOBALS[$var] = $val;
}
- $langObj = Language::factory( $lang );
- $GLOBALS['wgLang'] = $langObj;
- $GLOBALS['wgContLang'] = $langObj;
+ $context = new RequestContext();
+ $GLOBALS['wgLang'] = $context->lang;
+ $GLOBALS['wgContLang'] = $context->lang;
$GLOBALS['wgMemc'] = new EmptyBagOStuff;
- $GLOBALS['wgOut'] = new OutputPage;
+ $GLOBALS['wgOut'] = new $context->output;
global $wgHooks;
$GLOBALS[$var] = $val;
}
- $langObj = Language::factory( $lang );
- $GLOBALS['wgLang'] = $langObj;
- $GLOBALS['wgContLang'] = $langObj;
+ $context = new RequestContext();
+ $GLOBALS['wgLang'] = $context->lang;
+ $GLOBALS['wgContLang'] = $context->lang;
$GLOBALS['wgMemc'] = new EmptyBagOStuff;
- $GLOBALS['wgOut'] = new OutputPage;
+ $GLOBALS['wgOut'] = new $context->output;
global $wgHooks;