r85228 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85227‎ | r85228 | r85229 >
Date:04:37, 3 April 2011
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Followup r85227, update 4 special pages to properly use the context.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialActiveusers.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllpages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlankpage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialAllpages.php
@@ -58,25 +58,27 @@
5959 * @param $par String: becomes "FOO" when called like Special:Allpages/FOO (default NULL)
6060 */
6161 function execute( $par ) {
62 - global $wgRequest, $wgOut, $wgContLang;
 62+ global $wgContLang;
 63+ $request = $this->getRequest();
 64+ $out = $this->getOutput();
6365
6466 $this->setHeaders();
6567 $this->outputHeader();
66 - $wgOut->allowClickjacking();
 68+ $out->allowClickjacking();
6769
6870 # GET values
69 - $from = $wgRequest->getVal( 'from', null );
70 - $to = $wgRequest->getVal( 'to', null );
71 - $namespace = $wgRequest->getInt( 'namespace' );
 71+ $from = $request->getVal( 'from', null );
 72+ $to = $request->getVal( 'to', null );
 73+ $namespace = $request->getInt( 'namespace' );
7274
7375 $namespaces = $wgContLang->getNamespaces();
7476
75 - $wgOut->setPagetitle(
 77+ $out->setPagetitle(
7678 ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces) ) ) ?
7779 wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) :
7880 wfMsg( 'allarticles' )
7981 );
80 - $wgOut->addModuleStyles( 'mediawiki.special' );
 82+ $out->addModuleStyles( 'mediawiki.special' );
8183
8284 if( isset($par) ) {
8385 $this->showChunk( $namespace, $par, $to );
@@ -142,7 +144,7 @@
143145 * @param $to String: list all pages to this name
144146 */
145147 function showToplevel( $namespace = NS_MAIN, $from = '', $to = '' ) {
146 - global $wgOut;
 148+ $output = $this->getOutput();
147149
148150 # TODO: Either make this *much* faster or cache the title index points
149151 # in the querycache table.
@@ -221,7 +223,7 @@
222224 if( !empty($lines) ) {
223225 $this->showChunk( $namespace, $from, $to );
224226 } else {
225 - $wgOut->addHTML( $this->namespaceForm( $namespace, $from, $to ) );
 227+ $output->addHTML( $this->namespaceForm( $namespace, $from, $to ) );
226228 }
227229 return;
228230 }
@@ -241,14 +243,13 @@
242244 $out2 = '';
243245 } else {
244246 if( isset($from) || isset($to) ) {
245 - global $wgUser;
246247 $out2 = Xml::openElement( 'table', array( 'class' => 'mw-allpages-table-form' ) ).
247248 '<tr>
248249 <td>' .
249250 $nsForm .
250251 '</td>
251252 <td class="mw-allpages-nav">' .
252 - $wgUser->getSkin()->link( $this->getTitle(), wfMsgHtml ( 'allpages' ),
 253+ $this->getSkin()->link( $this->getTitle(), wfMsgHtml ( 'allpages' ),
253254 array(), array(), 'known' ) .
254255 "</td>
255256 </tr>" .
@@ -257,7 +258,7 @@
258259 $out2 = $nsForm;
259260 }
260261 }
261 - $wgOut->addHTML( $out2 . $out );
 262+ $output->addHTML( $out2 . $out );
262263 }
263264
264265 /**
@@ -292,10 +293,10 @@
293294 * @param $to String: list all pages to this name (default FALSE)
294295 */
295296 function showChunk( $namespace = NS_MAIN, $from = false, $to = false ) {
296 - global $wgOut, $wgUser, $wgContLang, $wgLang;
 297+ global $wgContLang, $wgLang;
 298+ $output = $this->getOutput();
 299+ $sk = $this->getSkin();
297300
298 - $sk = $wgUser->getSkin();
299 -
300301 $fromList = $this->getNamespaceKeyAndText($namespace, $from);
301302 $toList = $this->getNamespaceKeyAndText( $namespace, $to );
302303 $namespaces = $wgContLang->getNamespaces();
@@ -447,14 +448,14 @@
448449 $out2 .= "</td></tr></table>";
449450 }
450451
451 - $wgOut->addHTML( $out2 . $out );
 452+ $output->addHTML( $out2 . $out );
452453
453454 $links = array();
454455 if ( isset( $prevLink ) ) $links[] = $prevLink;
455456 if ( isset( $nextLink ) ) $links[] = $nextLink;
456457
457458 if ( count( $links ) ) {
458 - $wgOut->addHTML(
 459+ $output->addHTML(
459460 Html::element( 'hr' ) .
460461 Html::rawElement( 'div', array( 'class' => 'mw-allpages-nav' ),
461462 $wgLang->pipeList( $links )
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -49,32 +49,33 @@
5050 * @param $par Mixed: parameter passed to the page or null
5151 */
5252 public function execute( $par ) {
53 - global $wgOut, $wgRequest;
 53+ $request = $this->getRequest();
 54+ $out = $this->getOutput();
5455
5556 $this->setHeaders();
5657
5758 global $wgUseDatabaseMessages;
5859 if( !$wgUseDatabaseMessages ) {
59 - $wgOut->addWikiMsg( 'allmessagesnotsupportedDB' );
 60+ $out->addWikiMsg( 'allmessagesnotsupportedDB' );
6061 return;
6162 } else {
6263 $this->outputHeader( 'allmessagestext' );
6364 }
6465
65 - $wgOut->addModuleStyles( 'mediawiki.special' );
 66+ $out->addModuleStyles( 'mediawiki.special' );
6667
67 - $this->filter = $wgRequest->getVal( 'filter', 'all' );
68 - $this->prefix = $wgRequest->getVal( 'prefix', '' );
 68+ $this->filter = $request->getVal( 'filter', 'all' );
 69+ $this->prefix = $request->getVal( 'prefix', '' );
6970
7071 $this->table = new AllmessagesTablePager(
7172 $this,
7273 array(),
73 - wfGetLangObj( $wgRequest->getVal( 'lang', $par ) )
 74+ wfGetLangObj( $request->getVal( 'lang', $par ) )
7475 );
7576
7677 $this->langCode = $this->table->lang->getCode();
7778
78 - $wgOut->addHTML( $this->buildForm() .
 79+ $out->addHTML( $this->buildForm() .
7980 $this->table->getNavigationBar() .
8081 $this->table->getLimitForm() .
8182 $this->table->getBody() .
Index: trunk/phase3/includes/specials/SpecialActiveusers.php
@@ -187,4 +187,4 @@
188188
189189 return $out;
190190 }
191 -}
\ No newline at end of file
 191+}
Index: trunk/phase3/includes/specials/SpecialBlankpage.php
@@ -32,8 +32,7 @@
3333 parent::__construct( 'Blankpage' );
3434 }
3535 public function execute( $par ) {
36 - global $wgOut;
3736 $this->setHeaders();
38 - $wgOut->addWikiMsg('intentionallyblankpage');
 37+ $this->getOutput()>addWikiMsg('intentionallyblankpage');
3938 }
4039 }

Sign-offs

UserFlagDate
Nikerabbitinspected15:14, 3 April 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r85235Followup r85228; Small fix for ()> syntax error that should have been ()->dantman08:49, 3 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85227Start managing output and input context from special pages themselves instead...dantman04:36, 3 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   08:33, 3 April 2011
+$this->getOutput()>addWikiMsg('intentionallyblankpage');
#Comment by Dantman (talk | contribs)   08:49, 3 April 2011

Fixed.

Status & tagging log