r100126 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100125‎ | r100126 | r100127 >
Date:17:26, 18 October 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Add documentation

Fix some unused variables, commented some others out
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/Ibm_db2Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/LocalSettingsGenerator.php (modified) (history)
  • /trunk/phase3/includes/installer/MysqlInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/OracleInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/PostgresInstaller.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
@@ -355,6 +355,7 @@
356356
357357 /**
358358 * Show an error message in a box. Parameters are like wfMsg().
 359+ * @param $msg
359360 */
360361 public function showError( $msg /*...*/ ) {
361362 $args = func_get_args();
@@ -366,6 +367,8 @@
367368
368369 /**
369370 * Temporary error handler for session start debugging.
 371+ * @param $errno
 372+ * @param $errstr string
370373 */
371374 public function errorHandler( $errno, $errstr ) {
372375 $this->phpErrors[] = $errstr;
@@ -630,6 +633,7 @@
631634 * Get small text indented help for a preceding form field.
632635 * Parameters like wfMsg().
633636 *
 637+ * @param $msg
634638 * @return string
635639 */
636640 public function getHelpBox( $msg /*, ... */ ) {
@@ -638,7 +642,7 @@
639643 $args = array_map( 'htmlspecialchars', $args );
640644 $text = wfMsgReal( $msg, $args, false, false, false );
641645 $html = htmlspecialchars( $text );
642 - $html = $this->parse( $text, true );
 646+ $html = $this->parse( $html, true );
643647
644648 return "<div class=\"mw-help-field-container\">\n" .
645649 "<span class=\"mw-help-field-hint\">" . wfMsgHtml( 'config-help' ) . "</span>\n" .
@@ -687,6 +691,10 @@
688692 * Label a control by wrapping a config-input div around it and putting a
689693 * label before it.
690694 *
 695+ * @param $msg
 696+ * @param $forId
 697+ * @param $contents
 698+ * @param $helpData string
691699 * @return string
692700 */
693701 public function label( $msg, $forId, $contents, $helpData = "" ) {
@@ -1013,6 +1021,7 @@
10141022 /**
10151023 * Helper for Installer::docLink()
10161024 *
 1025+ * @param $page
10171026 * @return string
10181027 */
10191028 protected function getDocUrl( $page ) {
@@ -1028,6 +1037,9 @@
10291038 /**
10301039 * Extension tag hook for a documentation link.
10311040 *
 1041+ * @param $linkText
 1042+ * @param $attribs
 1043+ * @param $parser
10321044 * @return string
10331045 */
10341046 public function docLink( $linkText, $attribs, $parser ) {
@@ -1040,6 +1052,9 @@
10411053 /**
10421054 * Helper for "Download LocalSettings" link on WebInstall_Complete
10431055 *
 1056+ * @param $text
 1057+ * @param $attribs
 1058+ * @param $parser
10441059 * @return String Html for download link
10451060 */
10461061 public function downloadLinkHook( $text, $attribs, $parser ) {
Index: trunk/phase3/includes/installer/Installer.php
@@ -1118,6 +1118,9 @@
11191119 /**
11201120 * Same as locateExecutable(), but checks in getPossibleBinPaths() by default
11211121 * @see locateExecutable()
 1122+ * @param $names
 1123+ * @param $versionInfo bool
 1124+ * @return bool|string
11221125 */
11231126 public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) {
11241127 foreach( self::getPossibleBinPaths() as $path ) {
@@ -1204,6 +1207,8 @@
12051208
12061209 /**
12071210 * Overridden by WebInstaller to provide lastPage parameters.
 1211+ * @param $page stirng
 1212+ * @return string
12081213 */
12091214 protected function getDocUrl( $page ) {
12101215 return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
@@ -1491,6 +1496,7 @@
14921497 /**
14931498 * Insert Main Page with default content.
14941499 *
 1500+ * @param $installer DatabaseInstaller
14951501 * @return Status
14961502 */
14971503 protected function createMainpage( DatabaseInstaller $installer ) {
Index: trunk/phase3/includes/installer/Ibm_db2Installer.php
@@ -144,6 +144,9 @@
145145 if ( !$status->isOK() ) {
146146 return $status;
147147 }
 148+ /**
 149+ * @var $conn DatabaseBase
 150+ */
148151 $conn = $status->value;
149152 $dbName = $this->getVar( 'wgDBname' );
150153 if( !$conn->selectDB( $dbName ) ) {
Index: trunk/phase3/includes/installer/DatabaseInstaller.php
@@ -281,6 +281,7 @@
282282 /**
283283 * Construct and initialise parent.
284284 * This is typically only called from Installer::getDBInstaller()
 285+ * @param $parent
285286 */
286287 public function __construct( $parent ) {
287288 $this->parent = $parent;
@@ -291,6 +292,8 @@
292293 * Check if a named extension is present.
293294 *
294295 * @see wfDl
 296+ * @param $name
 297+ * @return bool
295298 */
296299 protected static function checkExtension( $name ) {
297300 wfSuppressWarnings();
@@ -323,6 +326,9 @@
324327
325328 /**
326329 * Get a variable, taking local defaults into account.
 330+ * @param $var string
 331+ * @param $default null
 332+ * @return mixed
327333 */
328334 public function getVar( $var, $default = null ) {
329335 $defaults = $this->getGlobalDefaults();
@@ -337,6 +343,8 @@
338344
339345 /**
340346 * Convenience alias for $this->parent->setVar()
 347+ * @param $name string
 348+ * @param $value mixed
341349 */
342350 public function setVar( $name, $value ) {
343351 $this->parent->setVar( $name, $value );
@@ -345,6 +353,10 @@
346354 /**
347355 * Get a labelled text box to configure a local variable.
348356 *
 357+ * @param $var string
 358+ * @param $label string
 359+ * @param $attribs array
 360+ * @param $helpData string
349361 * @return string
350362 */
351363 public function getTextBox( $var, $label, $attribs = array(), $helpData = "" ) {
@@ -367,6 +379,10 @@
368380 * Get a labelled password box to configure a local variable.
369381 * Implements password hiding.
370382 *
 383+ * @param $var string
 384+ * @param $label string
 385+ * @param $attribs array
 386+ * @param $helpData string
371387 * @return string
372388 */
373389 public function getPasswordBox( $var, $label, $attribs = array(), $helpData = "" ) {
Index: trunk/phase3/includes/installer/LocalSettingsGenerator.php
@@ -187,7 +187,7 @@
188188 $locale = '';
189189 }
190190
191 - $rightsUrl = $this->values['wgRightsUrl'] ? '' : '#';
 191+ //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // TODO: Fixme, I'm unused!
192192 $hashedUploads = $this->safeMode ? '' : '#';
193193 $metaNamespace = '';
194194 if( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
Index: trunk/phase3/includes/installer/MysqlInstaller.php
@@ -113,6 +113,9 @@
114114 if ( !$status->isOK() ) {
115115 return $status;
116116 }
 117+ /**
 118+ * @var $conn DatabaseBase
 119+ */
117120 $conn = $status->value;
118121
119122 // Check version
@@ -154,6 +157,9 @@
155158 $this->parent->showStatusError( $status );
156159 return;
157160 }
 161+ /**
 162+ * @var $conn DatabaseBase
 163+ */
158164 $conn = $status->value;
159165 $conn->selectDB( $this->getVar( 'wgDBname' ) );
160166
@@ -212,6 +218,9 @@
213219 if ( !$status->isOK() ) {
214220 return $engines;
215221 }
 222+ /**
 223+ * @var $conn DatabaseBase
 224+ */
216225 $conn = $status->value;
217226
218227 $version = $conn->getServerVersion();
@@ -259,6 +268,9 @@
260269 if ( !$status->isOK() ) {
261270 return false;
262271 }
 272+ /**
 273+ * @var $conn DatabaseBase
 274+ */
263275 $conn = $status->value;
264276
265277 // Check version, need INFORMATION_SCHEMA and CREATE USER
Index: trunk/phase3/includes/installer/OracleInstaller.php
@@ -117,6 +117,10 @@
118118 return $statusIS3;
119119 }
120120 }
 121+
 122+ /**
 123+ * @var $conn DatabaseBase
 124+ */
121125 $conn = $status->value;
122126
123127 // Check version
Index: trunk/phase3/includes/installer/PostgresInstaller.php
@@ -80,6 +80,9 @@
8181 if ( !$status->isOK() ) {
8282 return $status;
8383 }
 84+ /**
 85+ * @var $conn DatabaseBase
 86+ */
8487 $conn = $status->value;
8588
8689 // Check version
@@ -139,6 +142,9 @@
140143 $status = $this->openPgConnection( $type );
141144
142145 if ( $status->isOK() ) {
 146+ /**
 147+ * @var $conn DatabaseBase
 148+ */
143149 $conn = $status->value;
144150 $conn->clearFlag( DBO_TRX );
145151 $conn->commit();
@@ -186,6 +192,9 @@
187193 case 'create-tables':
188194 $status = $this->openPgConnection( 'create-schema' );
189195 if ( $status->isOK() ) {
 196+ /**
 197+ * @var $conn DatabaseBase
 198+ */
190199 $conn = $status->value;
191200 $safeRole = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) );
192201 $conn->query( "SET ROLE $safeRole" );
@@ -204,6 +213,7 @@
205214 if ( !in_array( $this->getVar( 'wgDBname' ), $dbs ) ) {
206215 array_unshift( $dbs, $this->getVar( 'wgDBname' ) );
207216 }
 217+ $conn = false;
208218 $status = Status::newGood();
209219 foreach ( $dbs as $db ) {
210220 try {
@@ -233,6 +243,9 @@
234244 if ( !$status->isOK() ) {
235245 return false;
236246 }
 247+ /**
 248+ * @var $conn DatabaseBase
 249+ */
237250 $conn = $status->value;
238251 $superuser = $this->getVar( '_InstallUser' );
239252
@@ -418,8 +431,8 @@
419432 $dbName = $this->getVar( 'wgDBname' );
420433 $schema = $this->getVar( 'wgDBmwschema' );
421434 $user = $this->getVar( 'wgDBuser' );
422 - $safeschema = $conn->addIdentifierQuotes( $schema );
423 - $safeuser = $conn->addIdentifierQuotes( $user );
 435+ //$safeschema = $conn->addIdentifierQuotes( $schema );
 436+ //$safeuser = $conn->addIdentifierQuotes( $user );
424437
425438 $exists = $conn->selectField( '"pg_catalog"."pg_database"', '1',
426439 array( 'datname' => $dbName ), __METHOD__ );
@@ -481,7 +494,7 @@
482495 $schema = $this->getVar( 'wgDBmwschema' );
483496 $safeuser = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) );
484497 $safepass = $conn->addQuotes( $this->getVar( 'wgDBpassword' ) );
485 - $safeschema = $conn->addIdentifierQuotes( $schema );
 498+ //$safeschema = $conn->addIdentifierQuotes( $schema );
486499
487500 // Check if the user already exists
488501 $userExists = $conn->roleExists( $this->getVar( 'wgDBuser' ) );
@@ -532,6 +545,10 @@
533546 if ( !$status->isOK() ) {
534547 return $status;
535548 }
 549+
 550+ /**
 551+ * @var $conn DatabaseBase
 552+ */
536553 $conn = $status->value;
537554
538555 if( $conn->tableExists( 'user' ) ) {
@@ -567,6 +584,9 @@
568585 if ( !$status->isOK() ) {
569586 return $status;
570587 }
 588+ /**
 589+ * @var $conn DatabaseBase
 590+ */
571591 $conn = $status->value;
572592
573593 $exists = $conn->selectField( '"pg_catalog"."pg_language"', 1,
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -212,6 +212,10 @@
213213 /**
214214 * Get a <select> for selecting languages.
215215 *
 216+ * @param $name
 217+ * @param $label
 218+ * @param $selectedCode
 219+ * @param $helpHtml string
216220 * @return string
217221 */
218222 public function getLanguageSelector( $name, $label, $selectedCode, $helpHtml = '' ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r102098Followup r100126, per brion remove htmlspecialchars() call...reedy14:22, 5 November 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   21:29, 3 November 2011
 		$html = htmlspecialchars( $text );
-		$html = $this->parse( $text, true );
+		$html = $this->parse( $html, true );

This looks wrong -- it kinda looks like the first line should be removed instead of this change to the second line; if we're parsing wikitext, we generally don't want to htmlspecialchars() it first.

#Comment by Krinkle (talk | contribs)   01:48, 27 December 2011

stirng typo

Status & tagging log