r81133 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81132‎ | r81133 | r81134 >
Date:15:00, 28 January 2011
Author:demon
Status:ok (Comments)
Tags:
Comment:
Minor cleanup, docs
Modified paths:
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/PhpBugTests.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -31,12 +31,13 @@
3232 *
3333 * @var array
3434 */
35 - public $session;
 35+ protected $session;
3636
3737 /**
3838 * Captured PHP error text. Temporary.
 39+ * @var array
3940 */
40 - public $phpErrors;
 41+ protected $phpErrors;
4142
4243 /**
4344 * The main sequence of page names. These will be displayed in turn.
@@ -44,6 +45,7 @@
4546 * * Add it here
4647 * * Add a config-page-<name> message
4748 * * Add a WebInstaller_<name> class
 49+ * @var array
4850 */
4951 public $pageSequence = array(
5052 'Language',
@@ -60,8 +62,9 @@
6163
6264 /**
6365 * Out of sequence pages, selectable by the user at any time.
 66+ * @var array
6467 */
65 - public $otherPages = array(
 68+ protected $otherPages = array(
6669 'Restart',
6770 'Readme',
6871 'ReleaseNotes',
@@ -72,24 +75,35 @@
7376 /**
7477 * Array of pages which have declared that they have been submitted, have validated
7578 * their input, and need no further processing.
 79+ * @var array
7680 */
77 - public $happyPages;
 81+ protected $happyPages;
7882
7983 /**
8084 * List of "skipped" pages. These are pages that will automatically continue
8185 * to the next page on any GET request. To avoid breaking the "back" button,
8286 * they need to be skipped during a back operation.
 87+ * @var array
8388 */
84 - public $skippedPages;
 89+ protected $skippedPages;
8590
8691 /**
8792 * Flag indicating that session data may have been lost.
 93+ * @var bool
8894 */
8995 public $showSessionWarning = false;
9096
91 - public $tabIndex = 1;
 97+ /**
 98+ * Numeric index of the page we're on
 99+ * @var int
 100+ */
 101+ protected $tabIndex = 1;
92102
93 - public $currentPageName;
 103+ /**
 104+ * Name of the page we're on
 105+ * @var string
 106+ */
 107+ protected $currentPageName;
94108
95109 /**
96110 * Constructor.
@@ -265,6 +279,10 @@
266280 return $this->finish();
267281 }
268282
 283+ /**
 284+ * Find the next page in sequence that hasn't been completed
 285+ * @return int
 286+ */
269287 public function getLowestUnhappy() {
270288 if ( count( $this->happyPages ) == 0 ) {
271289 return 0;
@@ -348,9 +366,19 @@
349367 }
350368
351369 /**
 370+ * We're restarting the installation, reset the session, happyPages, etc
 371+ */
 372+ public function reset() {
 373+ $this->session = array();
 374+ $this->happyPages = array();
 375+ $this->settings = array();
 376+ }
 377+
 378+ /**
352379 * Get a URL for submission back to the same script.
353380 *
354381 * @param $query: Array
 382+ * @return string
355383 */
356384 public function getUrl( $query = array() ) {
357385 $url = $this->request->getRequestURL();
@@ -368,7 +396,6 @@
369397 * Get a WebInstallerPage by name.
370398 *
371399 * @param $pageName String
372 - *
373400 * @return WebInstallerPage
374401 */
375402 public function getPageByName( $pageName ) {
@@ -396,6 +423,8 @@
397424
398425 /**
399426 * Set a session variable.
 427+ * @param $name String key for the variable
 428+ * @param $value Mixed
400429 */
401430 public function setSession( $name, $value ) {
402431 $this->session[$name] = $value;
@@ -403,6 +432,7 @@
404433
405434 /**
406435 * Get the next tabindex attribute value.
 436+ * @return int
407437 */
408438 public function nextTabIndex() {
409439 return $this->tabIndex++;
@@ -608,6 +638,7 @@
609639
610640 /**
611641 * Output a help box.
 642+ * @param $msg String key for wfMsg()
612643 */
613644 public function showHelpBox( $msg /*, ... */ ) {
614645 $args = func_get_args();
@@ -920,6 +951,10 @@
921952 return $url;
922953 }
923954
 955+ /**
 956+ * Helper for "Download LocalSettings" link on WebInstall_Complete
 957+ * @return String Html for download link
 958+ */
924959 public function downloadLinkHook( $text, $attribs, $parser ) {
925960 $img = Html::element( 'img', array(
926961 'src' => '../skins/common/images/download-32.png',
Index: trunk/phase3/includes/installer/Installer.php
@@ -24,11 +24,9 @@
2525 abstract class Installer {
2626
2727 /**
28 - * TODO: make protected?
29 - *
3028 * @var array
3129 */
32 - public $settings;
 30+ protected $settings;
3331
3432 /**
3533 * Cached DB installer instances, access using getDBInstaller().
Index: trunk/phase3/includes/installer/PhpBugTests.php
@@ -18,13 +18,15 @@
1919 * http://www.gnu.org/copyleft/gpl.html
2020 *
2121 * @file
22 - * @ingroup SpecialPage
 22+ * @defgroup PHPBugTests
 23+ * @ingroup PHPBugTests
2324 */
2425
2526 /**
2627 * Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
2728 * Known fixed with PHP 5.2.9 + libxml2-2.7.3
2829 * @see http://bugs.php.net/bug.php?id=45996
 30+ * @ingroup PHPBugTests
2931 */
3032 class PhpXmlBugTester {
3133 private $parsedData = '';
@@ -46,6 +48,7 @@
4749 /**
4850 * Test for PHP bug #50394 (PHP 5.3.x conversion to null only, not 5.2.x)
4951 * @see http://bugs.php.net/bug.php?id=45996
 52+ * @ingroup PHPBugTests
5053 */
5154 class PhpRefCallBugTester {
5255 public $ok = false;
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -1082,9 +1082,7 @@
10831083 if ( $r->wasPosted() ) {
10841084 $really = $r->getVal( 'submit-restart' );
10851085 if ( $really ) {
1086 - $this->parent->session = array();
1087 - $this->parent->happyPages = array();
1088 - $this->parent->settings = array();
 1086+ $this->parent->reset();
10891087 }
10901088 return 'continue';
10911089 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r81151Some adjustments to new functionality from r81133...krinkle19:25, 28 January 2011

Comments

#Comment by Krinkle (talk | contribs)   19:27, 28 January 2011

The headings are overwritten and the first one is removed. (arrays start at 0, first count is 1, +1 difference)

#Comment by Krinkle (talk | contribs)   19:27, 28 January 2011

Eh, wrong rev number

Status & tagging log