From: Happy-melon Date: Fri, 3 Jun 2011 11:04:49 +0000 (+0000) Subject: More unpicking of r85288. I think this is all of the magic method calls, but they... X-Git-Tag: 1.31.0-rc.0~29739 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=295f513e8bfde3d6b378f6d6e39e5b448af2be03;p=lhc%2Fweb%2Fwiklou.git More unpicking of r85288. I think this is all of the magic method calls, but they're very hard to grep for (part of the problem with them!), so let's leave the calls in with a wfDeprecated() for a while... --- diff --git a/includes/RequestContext.php b/includes/RequestContext.php index 908eba1f2f..a796a633a0 100644 --- a/includes/RequestContext.php +++ b/includes/RequestContext.php @@ -219,6 +219,7 @@ class RequestContext implements IContextSource { * @return string */ public function __get( $name ) { + wfDeprecated( 'RequestContext::__get() is deprecated; use $context->getFoo() instead' ); if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) { $fname = 'get' . ucfirst( $name ); return $this->$fname(); @@ -232,6 +233,7 @@ class RequestContext implements IContextSource { * @return string */ public function __set( $name, $value ) { + wfDeprecated( 'RequestContext::__set() is deprecated; use $context->setFoo() instead' ); if ( in_array( $name, array( 'request', 'title', 'output', 'user', 'lang', 'skin' ) ) ) { $fname = 'set' . ucfirst( $name ); return $this->$fname( $value ); diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index ee194e600f..a5dfe77aac 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -873,8 +873,8 @@ abstract class RedirectSpecialPage extends UnlistedSpecialPage { $params = array(); foreach( $this->mAllowedRedirectParams as $arg ) { - if( $this->getContext()->request->getVal( $arg, null ) !== null ){ - $params[$arg] = $this->getContext()->request->getVal( $arg ); + if( $this->getRequest()->getVal( $arg, null ) !== null ){ + $params[$arg] = $this->getRequest()->getVal( $arg ); } } diff --git a/includes/actions/DeleteAction.php b/includes/actions/DeleteAction.php index 9f4d8cc059..f0a3a9bc8b 100644 --- a/includes/actions/DeleteAction.php +++ b/includes/actions/DeleteAction.php @@ -236,7 +236,7 @@ class DeleteAction extends Action { $data['Reason'] = (array)$data['Reason']; $error = null; - if ( !wfRunHooks( 'ArticleDelete', array( &$page, &$context->user, &$data['Reason'][0], &$error ) ) ) { + if ( !wfRunHooks( 'ArticleDelete', array( &$page, $context->getUser(), &$data['Reason'][0], &$error ) ) ) { return $error; } @@ -376,7 +376,7 @@ class DeleteAction extends Action { $dbw->commit(); } - wfRunHooks( 'ArticleDeleteComplete', array( &$page, &$context->user, $data['Reason'][0], $id ) ); + wfRunHooks( 'ArticleDeleteComplete', array( &$page, $context->getUser(), $data['Reason'][0], $id ) ); return true; } diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 71f4946926..392ec73e57 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -244,22 +244,22 @@ class ApiParse extends ApiBase { if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) { $context = new RequestContext; - $context->output->addParserOutputNoText( $p_result ); + $context->getOutput()->addParserOutputNoText( $p_result ); if ( isset( $prop['headitems'] ) ) { $headItems = $this->formatHeadItems( $p_result->getHeadItems() ); - $context->skin->setupUserCss( $context->output ); - $css = $this->formatCss( $context->output->buildCssLinksArray() ); + $context->getSkin()->setupUserCss( $context->getOutput() ); + $css = $this->formatCss( $context->getOutput()->buildCssLinksArray() ); - $scripts = array( $context->output->getHeadScripts( $context->skin ) ); + $scripts = array( $context->getOutput()->getHeadScripts( $context->getSkin() ) ); $result_array['headitems'] = array_merge( $headItems, $css, $scripts ); } if ( isset( $prop['headhtml'] ) ) { $result_array['headhtml'] = array(); - $result->setContent( $result_array['headhtml'], $context->output->headElement( $context->skin ) ); + $result->setContent( $result_array['headhtml'], $context->getOutput()->headElement( $context->getSkin() ) ); } } diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index 82112ef173..42897aff7e 100644 --- a/maintenance/rebuildFileCache.php +++ b/maintenance/rebuildFileCache.php @@ -79,7 +79,7 @@ class RebuildFileCache extends Maintenance { $this->output( "Page {$row->page_id} has bad title\n" ); continue; // broken title? } - $wgOut = $context->output; // set display title + $wgOut = $context->getOutput(); // set display title $article = new Article( $wgTitle ); // If the article is cacheable, then load it if ( $article->isFileCacheable() ) { diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index 0cae3308dd..2ac38e4968 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -79,8 +79,8 @@ class NewParserTest extends MediaWikiTestCase { // $tmpGlobals['wgContLang'] = new StubContLang; $tmpGlobals['wgUser'] = new User; $context = new RequestContext(); - $tmpGlobals['wgLang'] = $context->lang; - $tmpGlobals['wgOut'] = $context->output; + $tmpGlobals['wgLang'] = $context->getLang(); + $tmpGlobals['wgOut'] = $context->getOutput(); $tmpGlobals['wgParser'] = new StubObject( 'wgParser', $GLOBALS['wgParserConf']['class'], array( $GLOBALS['wgParserConf'] ) ); $tmpGlobals['wgRequest'] = new WebRequest; @@ -312,10 +312,10 @@ class NewParserTest extends MediaWikiTestCase { $langObj = Language::factory( $lang ); $GLOBALS['wgContLang'] = $langObj; $context = new RequestContext(); - $GLOBALS['wgLang'] = $context->lang; + $GLOBALS['wgLang'] = $context->getLang(); $GLOBALS['wgMemc'] = new EmptyBagOStuff; - $GLOBALS['wgOut'] = $context->output; + $GLOBALS['wgOut'] = $context->getOutput(); global $wgHooks; diff --git a/tests/phpunit/suites/UploadFromUrlTestSuite.php b/tests/phpunit/suites/UploadFromUrlTestSuite.php index 9e6bf7f221..c9729fbbd3 100644 --- a/tests/phpunit/suites/UploadFromUrlTestSuite.php +++ b/tests/phpunit/suites/UploadFromUrlTestSuite.php @@ -49,8 +49,8 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { // $wgContLang = new StubContLang; $wgUser = new User; $context = new RequestContext; - $wgLang = $context->lang; - $wgOut = $context->output; + $wgLang = $context->getLang(); + $wgOut = $context->getOutput(); $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); $wgRequest = new WebRequest;