From 856faea6d6d85feb0d16ffd32f67b8625b81b4f5 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 18 Oct 2011 17:26:09 +0000 Subject: [PATCH] Add documentation Fix some unused variables, commented some others out --- includes/installer/DatabaseInstaller.php | 16 ++++++++++++ includes/installer/Ibm_db2Installer.php | 3 +++ includes/installer/Installer.php | 6 +++++ includes/installer/LocalSettingsGenerator.php | 2 +- includes/installer/MysqlInstaller.php | 12 +++++++++ includes/installer/OracleInstaller.php | 4 +++ includes/installer/PostgresInstaller.php | 26 ++++++++++++++++--- includes/installer/WebInstaller.php | 17 +++++++++++- includes/installer/WebInstallerPage.php | 4 +++ 9 files changed, 85 insertions(+), 5 deletions(-) diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 4e9e174fd5..6e002ec77f 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -281,6 +281,7 @@ abstract class DatabaseInstaller { /** * Construct and initialise parent. * This is typically only called from Installer::getDBInstaller() + * @param $parent */ public function __construct( $parent ) { $this->parent = $parent; @@ -291,6 +292,8 @@ abstract class DatabaseInstaller { * Check if a named extension is present. * * @see wfDl + * @param $name + * @return bool */ protected static function checkExtension( $name ) { wfSuppressWarnings(); @@ -323,6 +326,9 @@ abstract class DatabaseInstaller { /** * Get a variable, taking local defaults into account. + * @param $var string + * @param $default null + * @return mixed */ public function getVar( $var, $default = null ) { $defaults = $this->getGlobalDefaults(); @@ -337,6 +343,8 @@ abstract class DatabaseInstaller { /** * Convenience alias for $this->parent->setVar() + * @param $name string + * @param $value mixed */ public function setVar( $name, $value ) { $this->parent->setVar( $name, $value ); @@ -345,6 +353,10 @@ abstract class DatabaseInstaller { /** * Get a labelled text box to configure a local variable. * + * @param $var string + * @param $label string + * @param $attribs array + * @param $helpData string * @return string */ public function getTextBox( $var, $label, $attribs = array(), $helpData = "" ) { @@ -367,6 +379,10 @@ abstract class DatabaseInstaller { * Get a labelled password box to configure a local variable. * Implements password hiding. * + * @param $var string + * @param $label string + * @param $attribs array + * @param $helpData string * @return string */ public function getPasswordBox( $var, $label, $attribs = array(), $helpData = "" ) { diff --git a/includes/installer/Ibm_db2Installer.php b/includes/installer/Ibm_db2Installer.php index 46ddeef844..0f1c2a83ef 100644 --- a/includes/installer/Ibm_db2Installer.php +++ b/includes/installer/Ibm_db2Installer.php @@ -144,6 +144,9 @@ class Ibm_db2Installer extends DatabaseInstaller { if ( !$status->isOK() ) { return $status; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; $dbName = $this->getVar( 'wgDBname' ); if( !$conn->selectDB( $dbName ) ) { diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index d015327615..102ac38710 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -1118,6 +1118,9 @@ abstract class Installer { /** * Same as locateExecutable(), but checks in getPossibleBinPaths() by default * @see locateExecutable() + * @param $names + * @param $versionInfo bool + * @return bool|string */ public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) { foreach( self::getPossibleBinPaths() as $path ) { @@ -1204,6 +1207,8 @@ abstract class Installer { /** * Overridden by WebInstaller to provide lastPage parameters. + * @param $page stirng + * @return string */ protected function getDocUrl( $page ) { return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page ); @@ -1491,6 +1496,7 @@ abstract class Installer { /** * Insert Main Page with default content. * + * @param $installer DatabaseInstaller * @return Status */ protected function createMainpage( DatabaseInstaller $installer ) { diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 30fefee4e2..89154e58ca 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -187,7 +187,7 @@ class LocalSettingsGenerator { $locale = ''; } - $rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; + //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // TODO: Fixme, I'm unused! $hashedUploads = $this->safeMode ? '' : '#'; $metaNamespace = ''; if( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) { diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 0d76e6d9fd..43587ca104 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -113,6 +113,9 @@ class MysqlInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return $status; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; // Check version @@ -154,6 +157,9 @@ class MysqlInstaller extends DatabaseInstaller { $this->parent->showStatusError( $status ); return; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; $conn->selectDB( $this->getVar( 'wgDBname' ) ); @@ -212,6 +218,9 @@ class MysqlInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return $engines; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; $version = $conn->getServerVersion(); @@ -259,6 +268,9 @@ class MysqlInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return false; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; // Check version, need INFORMATION_SCHEMA and CREATE USER diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 175baf0b64..7f04f75ec8 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -117,6 +117,10 @@ class OracleInstaller extends DatabaseInstaller { return $statusIS3; } } + + /** + * @var $conn DatabaseBase + */ $conn = $status->value; // Check version diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 97f8efbec2..550efbdb00 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -80,6 +80,9 @@ class PostgresInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return $status; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; // Check version @@ -139,6 +142,9 @@ class PostgresInstaller extends DatabaseInstaller { $status = $this->openPgConnection( $type ); if ( $status->isOK() ) { + /** + * @var $conn DatabaseBase + */ $conn = $status->value; $conn->clearFlag( DBO_TRX ); $conn->commit(); @@ -186,6 +192,9 @@ class PostgresInstaller extends DatabaseInstaller { case 'create-tables': $status = $this->openPgConnection( 'create-schema' ); if ( $status->isOK() ) { + /** + * @var $conn DatabaseBase + */ $conn = $status->value; $safeRole = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) ); $conn->query( "SET ROLE $safeRole" ); @@ -204,6 +213,7 @@ class PostgresInstaller extends DatabaseInstaller { if ( !in_array( $this->getVar( 'wgDBname' ), $dbs ) ) { array_unshift( $dbs, $this->getVar( 'wgDBname' ) ); } + $conn = false; $status = Status::newGood(); foreach ( $dbs as $db ) { try { @@ -233,6 +243,9 @@ class PostgresInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return false; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; $superuser = $this->getVar( '_InstallUser' ); @@ -418,8 +431,8 @@ class PostgresInstaller extends DatabaseInstaller { $dbName = $this->getVar( 'wgDBname' ); $schema = $this->getVar( 'wgDBmwschema' ); $user = $this->getVar( 'wgDBuser' ); - $safeschema = $conn->addIdentifierQuotes( $schema ); - $safeuser = $conn->addIdentifierQuotes( $user ); + //$safeschema = $conn->addIdentifierQuotes( $schema ); + //$safeuser = $conn->addIdentifierQuotes( $user ); $exists = $conn->selectField( '"pg_catalog"."pg_database"', '1', array( 'datname' => $dbName ), __METHOD__ ); @@ -481,7 +494,7 @@ class PostgresInstaller extends DatabaseInstaller { $schema = $this->getVar( 'wgDBmwschema' ); $safeuser = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) ); $safepass = $conn->addQuotes( $this->getVar( 'wgDBpassword' ) ); - $safeschema = $conn->addIdentifierQuotes( $schema ); + //$safeschema = $conn->addIdentifierQuotes( $schema ); // Check if the user already exists $userExists = $conn->roleExists( $this->getVar( 'wgDBuser' ) ); @@ -532,6 +545,10 @@ class PostgresInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return $status; } + + /** + * @var $conn DatabaseBase + */ $conn = $status->value; if( $conn->tableExists( 'user' ) ) { @@ -567,6 +584,9 @@ class PostgresInstaller extends DatabaseInstaller { if ( !$status->isOK() ) { return $status; } + /** + * @var $conn DatabaseBase + */ $conn = $status->value; $exists = $conn->selectField( '"pg_catalog"."pg_language"', 1, diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 407264378c..5d910387d1 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -355,6 +355,7 @@ class WebInstaller extends Installer { /** * Show an error message in a box. Parameters are like wfMsg(). + * @param $msg */ public function showError( $msg /*...*/ ) { $args = func_get_args(); @@ -366,6 +367,8 @@ class WebInstaller extends Installer { /** * Temporary error handler for session start debugging. + * @param $errno + * @param $errstr string */ public function errorHandler( $errno, $errstr ) { $this->phpErrors[] = $errstr; @@ -630,6 +633,7 @@ class WebInstaller extends Installer { * Get small text indented help for a preceding form field. * Parameters like wfMsg(). * + * @param $msg * @return string */ public function getHelpBox( $msg /*, ... */ ) { @@ -638,7 +642,7 @@ class WebInstaller extends Installer { $args = array_map( 'htmlspecialchars', $args ); $text = wfMsgReal( $msg, $args, false, false, false ); $html = htmlspecialchars( $text ); - $html = $this->parse( $text, true ); + $html = $this->parse( $html, true ); return "
\n" . "" . wfMsgHtml( 'config-help' ) . "\n" . @@ -687,6 +691,10 @@ class WebInstaller extends Installer { * Label a control by wrapping a config-input div around it and putting a * label before it. * + * @param $msg + * @param $forId + * @param $contents + * @param $helpData string * @return string */ public function label( $msg, $forId, $contents, $helpData = "" ) { @@ -1013,6 +1021,7 @@ class WebInstaller extends Installer { /** * Helper for Installer::docLink() * + * @param $page * @return string */ protected function getDocUrl( $page ) { @@ -1028,6 +1037,9 @@ class WebInstaller extends Installer { /** * Extension tag hook for a documentation link. * + * @param $linkText + * @param $attribs + * @param $parser * @return string */ public function docLink( $linkText, $attribs, $parser ) { @@ -1040,6 +1052,9 @@ class WebInstaller extends Installer { /** * Helper for "Download LocalSettings" link on WebInstall_Complete * + * @param $text + * @param $attribs + * @param $parser * @return String Html for download link */ public function downloadLinkHook( $text, $attribs, $parser ) { diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 08235e3ebe..dd88578e8c 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -212,6 +212,10 @@ class WebInstaller_Language extends WebInstallerPage { /** * Get a