r85227 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85226‎ | r85227 | r85228 >
Date:04:36, 3 April 2011
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Start managing output and input context from special pages themselves instead of using globals. We already had a setContext, Special page implementations should be properly utalizing that data.
Modified paths:
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPage.php
@@ -996,7 +996,54 @@
997997 $this->mOutput = $output;
998998 $this->mFullTitle = $output->getTitle();
999999 }
 1000+
10001001 /**
 1002+ * Get the WebRequest being used for this instance
 1003+ *
 1004+ * @return WebRequest
 1005+ */
 1006+ public function getRequest() {
 1007+ if ( !isset($this->mRequest) ) {
 1008+ wfDebug( __METHOD__ . " called and \$mRequest is null. Return \$wgRequest for sanity\n" );
 1009+ global $wgRequest;
 1010+ return $wgRequest;
 1011+ }
 1012+ return $this->mRequest;
 1013+ }
 1014+
 1015+ /**
 1016+ * Get the OutputPage being used for this instance
 1017+ *
 1018+ * @return OutputPage
 1019+ */
 1020+ public function getOutput() {
 1021+ if ( !isset($this->mOutput) ) {
 1022+ wfDebug( __METHOD__ . " called and \$mOutput is null. Return \$wgOut for sanity\n" );
 1023+ global $wgOut;
 1024+ return $wgOut;
 1025+ }
 1026+ return $this->mOutput;
 1027+ }
 1028+
 1029+ /**
 1030+ * Shortcut to get the skin being used for this instance
 1031+ *
 1032+ * @return User
 1033+ */
 1034+ public function getUser() {
 1035+ return $this->getOutput()->getUser();
 1036+ }
 1037+
 1038+ /**
 1039+ * Shortcut to get the skin being used for this instance
 1040+ *
 1041+ * @return Skin
 1042+ */
 1043+ public function getSkin() {
 1044+ return $this->getOutput()->getSkin();
 1045+ }
 1046+
 1047+ /**
10011048 * Wrapper around wfMessage that sets the current context. Currently this
10021049 * is only the title.
10031050 *

Follow-up revisions

RevisionCommit summaryAuthorDate
r85228Followup r85227, update 4 special pages to properly use the context.dantman04:37, 3 April 2011
r85229Followup r85227. Convert all IncludableSpecialPages to use context properly (...dantman05:46, 3 April 2011
r85231Followup r85227; Back out changes related to avoiding calls to OutputPage fro...dantman06:26, 3 April 2011
r85234Follow-up r85226, r85227: add @since annotationsnikerabbit08:33, 3 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   15:14, 3 April 2011

How long do you plan to retain fallback to globals here?

#Comment by Dantman (talk | contribs)   21:40, 3 April 2011

No more globals, all that is inside RequestContext now.

Status & tagging log