r69660 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69659‎ | r69660 | r69661 >
Date:09:42, 21 July 2010
Author:jeroendedauw
Status:ok
Tags:
Comment:
Clarified field and method visibility and doc improvements
Modified paths:
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerOutput.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -128,7 +128,7 @@
129129
130130 $lowestUnhappy = $this->getLowestUnhappy();
131131
132 - # Special case for Creative Commons partner chooser box
 132+ # Special case for Creative Commons partner chooser box.
133133 if ( $this->request->getVal( 'SubmitCC' ) ) {
134134 $page = $this->getPageByName( 'Options' );
135135 $this->output->useShortHeader();
@@ -143,7 +143,7 @@
144144 return $this->finish();
145145 }
146146
147 - # Get the page name
 147+ # Get the page name.
148148 $pageName = $this->request->getVal( 'page' );
149149
150150 if ( in_array( $pageName, $this->otherPages ) ) {
@@ -162,7 +162,7 @@
163163 if ( $pageId > $lowestUnhappy ) {
164164 $pageId = $lowestUnhappy;
165165 if ( $lowestUnhappy == 0 ) {
166 - # Knocked back to start, possible loss of session data
 166+ # Knocked back to start, possible loss of session data.
167167 $this->showSessionWarning = true;
168168 }
169169 }
@@ -171,7 +171,7 @@
172172 $page = $this->getPageByName( $pageName );
173173 }
174174
175 - # If a back button was submitted, go back without submitting the form data
 175+ # If a back button was submitted, go back without submitting the form data.
176176 if ( $this->request->wasPosted() && $this->request->getBool( 'submit-back' ) ) {
177177 if ( $this->request->getVal( 'lastPage' ) ) {
178178 $nextPage = $this->request->getVal( 'lastPage' );
@@ -192,7 +192,7 @@
193193 return $this->finish();
194194 }
195195
196 - # Execute the page
 196+ # Execute the page.
197197 $this->currentPageName = $page->getName();
198198 $this->startPageWrapper( $pageName );
199199 $localSettings = $this->getLocalSettingsStatus();
@@ -207,15 +207,15 @@
208208 $this->endPageWrapper();
209209
210210 if ( $result == 'skip' ) {
211 - # Page skipped without explicit submission
212 - # Skip it when we click "back" so that we don't just go forward again
 211+ # Page skipped without explicit submission.
 212+ # Skip it when we click "back" so that we don't just go forward again.
213213 $this->skippedPages[$pageName] = true;
214214 $result = 'continue';
215215 } else {
216216 unset( $this->skippedPages[$pageName] );
217217 }
218218
219 - # If it was posted, the page can request a continue to the next page
 219+ # If it was posted, the page can request a continue to the next page.
220220 if ( $result === 'continue' && !$this->output->headerDone() ) {
221221 if ( $pageId !== false ) {
222222 $this->happyPages[$pageId] = true;
Index: trunk/phase3/includes/installer/WebInstallerOutput.php
@@ -9,58 +9,70 @@
1010 * that wouldn't be immediately obvious.
1111 */
1212 class WebInstallerOutput {
13 - var $parent;
14 - var $contents = '';
15 - var $warnings = '';
16 - var $headerDone = false;
17 - var $redirectTarget;
18 - var $debug = true;
19 - var $useShortHeader = false;
 13+
 14+ /**
 15+ * The WebInstaller object this WebInstallerOutput is used by.
 16+ *
 17+ * @var WebInstaller
 18+ */
 19+ public $parent;
 20+
 21+ public $contents = '';
 22+ public $warnings = '';
 23+ public $headerDone = false;
 24+ public $redirectTarget;
 25+ public $debug = true;
 26+ public $useShortHeader = false;
2027
21 - function __construct( $parent ) {
 28+ /**
 29+ * Constructor.
 30+ *
 31+ * @param WebInstaller $parent
 32+ */
 33+ public function __construct( WebInstaller $parent ) {
2234 $this->parent = $parent;
2335 }
2436
25 - function addHTML( $html ) {
 37+ public function addHTML( $html ) {
2638 $this->contents .= $html;
2739 $this->flush();
2840 }
2941
30 - function addWikiText( $text ) {
 42+ public function addWikiText( $text ) {
3143 $this->addHTML( $this->parent->parse( $text ) );
3244 }
3345
34 - function addHTMLNoFlush( $html ) {
 46+ public function addHTMLNoFlush( $html ) {
3547 $this->contents .= $html;
3648 }
3749
38 - function addWarning( $msg ) {
 50+ public function addWarning( $msg ) {
3951 $this->warnings .= "<p>$msg</p>\n";
4052 }
4153
42 - function addWarningMsg( $msg /*, ... */ ) {
 54+ public function addWarningMsg( $msg /*, ... */ ) {
4355 $params = func_get_args();
4456 array_shift( $params );
4557 $this->addWarning( wfMsg( $msg, $params ) );
4658 }
4759
48 - function redirect( $url ) {
 60+ public function redirect( $url ) {
4961 if ( $this->headerDone ) {
5062 throw new MWException( __METHOD__ . ' called after sending headers' );
5163 }
5264 $this->redirectTarget = $url;
5365 }
5466
55 - function output() {
 67+ public function output() {
5668 $this->flush();
5769 $this->outputFooter();
5870 }
5971
60 - function useShortHeader( $use = true ) {
 72+ public function useShortHeader( $use = true ) {
6173 $this->useShortHeader = $use;
6274 }
6375
64 - function flush() {
 76+ public function flush() {
6577 if ( !$this->headerDone ) {
6678 $this->outputHeader();
6779 }
@@ -72,7 +84,7 @@
7385 }
7486 }
7587
76 - function getDir() {
 88+ public function getDir() {
7789 global $wgLang;
7890 if( !is_object( $wgLang ) || !$wgLang->isRtl() )
7991 return 'ltr';
@@ -80,7 +92,7 @@
8193 return 'rtl';
8294 }
8395
84 - function getLanguageCode() {
 96+ public function getLanguageCode() {
8597 global $wgLang;
8698 if( !is_object( $wgLang ) )
8799 return 'en';
@@ -88,18 +100,18 @@
89101 return $wgLang->getCode();
90102 }
91103
92 - function getHeadAttribs() {
 104+ public function getHeadAttribs() {
93105 return array(
94106 'dir' => $this->getDir(),
95107 'lang' => $this->getLanguageCode(),
96108 );
97109 }
98110
99 - function headerDone() {
 111+ public function headerDone() {
100112 return $this->headerDone;
101113 }
102114
103 - function outputHeader() {
 115+ public function outputHeader() {
104116 $this->headerDone = true;
105117 $dbTypes = $this->parent->getDBTypes();
106118
@@ -144,7 +156,7 @@
145157 <?php
146158 }
147159
148 - function outputFooter() {
 160+ public function outputFooter() {
149161 $this->outputWarnings();
150162
151163 if ( $this->useShortHeader ) {
@@ -179,7 +191,7 @@
180192 <?php
181193 }
182194
183 - function outputShortHeader() {
 195+ public function outputShortHeader() {
184196 ?>
185197 <?php echo Html::htmlHeader( $this->getHeadAttribs() ); ?>
186198 <head>
@@ -196,18 +208,19 @@
197209 <?php
198210 }
199211
200 - function outputTitle() {
 212+ public function outputTitle() {
201213 global $wgVersion;
202214 echo htmlspecialchars( wfMsg( 'config-title', $wgVersion ) );
203215 }
204216
205 - function outputJQuery() {
 217+ public function outputJQuery() {
206218 global $wgJQueryVersion;
207219 echo Html::linkedScript( "../skins/common/jquery-$wgJQueryVersion.min.js" );
208220 }
209221
210 - function outputWarnings() {
 222+ public function outputWarnings() {
211223 $this->addHTML( $this->warnings );
212224 $this->warnings = '';
213225 }
214 -}
 226+
 227+}
\ No newline at end of file
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -14,8 +14,12 @@
1515
1616 public abstract function execute();
1717
 18+ /**
 19+ * Constructor.
 20+ *
 21+ * @param WebInstaller $parent
 22+ */
1823 public function __construct( WebInstaller $parent ) {
19 - // TODO: This field is not defined??
2024 $this->parent = $parent;
2125 }
2226

Status & tagging log