Minor cleanup, docs
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 28 Jan 2011 15:00:18 +0000 (15:00 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 28 Jan 2011 15:00:18 +0000 (15:00 +0000)
includes/installer/Installer.php
includes/installer/PhpBugTests.php
includes/installer/WebInstaller.php
includes/installer/WebInstallerPage.php

index d19a33c..3e571f5 100644 (file)
 abstract class Installer {
 
        /**
-        * TODO: make protected?
-        *
         * @var array
         */
-       public $settings;
+       protected $settings;
 
        /**
         * Cached DB installer instances, access using getDBInstaller().
index 0dba34a..9cafd15 100644 (file)
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @ingroup SpecialPage
+ * @defgroup PHPBugTests
+ * @ingroup PHPBugTests
  */
 
 /**
  * Test for PHP+libxml2 bug which breaks XML input subtly with certain versions.
  * Known fixed with PHP 5.2.9 + libxml2-2.7.3
  * @see http://bugs.php.net/bug.php?id=45996
+ * @ingroup PHPBugTests
  */
 class PhpXmlBugTester {
        private $parsedData = '';
@@ -46,6 +48,7 @@ class PhpXmlBugTester {
 /**
  * Test for PHP bug #50394 (PHP 5.3.x conversion to null only, not 5.2.x)
  * @see http://bugs.php.net/bug.php?id=45996
+ * @ingroup PHPBugTests
  */
 class PhpRefCallBugTester {
        public $ok = false;
index 9f43f04..e679524 100644 (file)
@@ -31,12 +31,13 @@ class WebInstaller extends Installer {
         *
         * @var array
         */
-       public $session;
+       protected $session;
 
        /**
         * Captured PHP error text. Temporary.
+        * @var array
         */
-       public $phpErrors;
+       protected $phpErrors;
 
        /**
         * The main sequence of page names. These will be displayed in turn.
@@ -44,6 +45,7 @@ class WebInstaller extends Installer {
         *    * Add it here
         *    * Add a config-page-<name> message
         *    * Add a WebInstaller_<name> class
+        * @var array
         */
        public $pageSequence = array(
                'Language',
@@ -60,8 +62,9 @@ class WebInstaller extends Installer {
 
        /**
         * Out of sequence pages, selectable by the user at any time.
+        * @var array
         */
-       public $otherPages = array(
+       protected $otherPages = array(
                'Restart',
                'Readme',
                'ReleaseNotes',
@@ -72,24 +75,35 @@ class WebInstaller extends Installer {
        /**
         * Array of pages which have declared that they have been submitted, have validated
         * their input, and need no further processing.
+        * @var array
         */
-       public $happyPages;
+       protected $happyPages;
 
        /**
         * List of "skipped" pages. These are pages that will automatically continue
         * to the next page on any GET request. To avoid breaking the "back" button,
         * they need to be skipped during a back operation.
+        * @var array
         */
-       public $skippedPages;
+       protected $skippedPages;
 
        /**
         * Flag indicating that session data may have been lost.
+        * @var bool
         */
        public $showSessionWarning = false;
 
-       public $tabIndex = 1;
+       /**
+        * Numeric index of the page we're on
+        * @var int
+        */
+       protected $tabIndex = 1;
 
-       public $currentPageName;
+       /**
+        * Name of the page we're on
+        * @var string
+        */
+       protected $currentPageName;
 
        /**
         * Constructor.
@@ -265,6 +279,10 @@ class WebInstaller extends Installer {
                return $this->finish();
        }
 
+       /**
+        * Find the next page in sequence that hasn't been completed
+        * @return int
+        */
        public function getLowestUnhappy() {
                if ( count( $this->happyPages ) == 0 ) {
                        return 0;
@@ -347,10 +365,20 @@ class WebInstaller extends Installer {
                return $this->session;
        }
 
+       /**
+        * We're restarting the installation, reset the session, happyPages, etc
+        */
+       public function reset() {
+               $this->session = array();
+               $this->happyPages = array();
+               $this->settings = array();
+       }
+
        /**
         * Get a URL for submission back to the same script.
         *
         * @param $query: Array
+        * @return string
         */
        public function getUrl( $query = array() ) {
                $url = $this->request->getRequestURL();
@@ -368,7 +396,6 @@ class WebInstaller extends Installer {
         * Get a WebInstallerPage by name.
         *
         * @param $pageName String
-        *
         * @return WebInstallerPage
         */
        public function getPageByName( $pageName ) {
@@ -396,6 +423,8 @@ class WebInstaller extends Installer {
 
        /**
         * Set a session variable.
+        * @param $name String key for the variable
+        * @param $value Mixed
         */
        public function setSession( $name, $value ) {
                $this->session[$name] = $value;
@@ -403,6 +432,7 @@ class WebInstaller extends Installer {
 
        /**
         * Get the next tabindex attribute value.
+        * @return int
         */
        public function nextTabIndex() {
                return $this->tabIndex++;
@@ -608,6 +638,7 @@ class WebInstaller extends Installer {
 
        /**
         * Output a help box.
+        * @param $msg String key for wfMsg()
         */
        public function showHelpBox( $msg /*, ... */ ) {
                $args = func_get_args();
@@ -920,6 +951,10 @@ class WebInstaller extends Installer {
                return $url;
        }
 
+       /**
+        * Helper for "Download LocalSettings" link on WebInstall_Complete
+        * @return String Html for download link
+        */
        public function downloadLinkHook( $text, $attribs, $parser  ) {
                $img = Html::element( 'img', array(
                        'src' => '../skins/common/images/download-32.png',
index d1b7f51..8ed0b2d 100644 (file)
@@ -1082,9 +1082,7 @@ class WebInstaller_Restart extends WebInstallerPage {
                if ( $r->wasPosted() ) {
                        $really = $r->getVal( 'submit-restart' );
                        if ( $really ) {
-                               $this->parent->session = array();
-                               $this->parent->happyPages = array();
-                               $this->parent->settings = array();
+                               $this->parent->reset();
                        }
                        return 'continue';
                }