From 90749a261cc7e2b1fe4e319f667c2cb6c9435f13 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 27 Aug 2013 17:38:27 -0700 Subject: [PATCH] doc: Remove repetitive "Give grep a chance" phrase from comments * Follows-up b2e2b2e016. * Minor clean up of surrounding documentation comments. * Fixed missing keys for messages in WebInstallerPage Change-Id: Iaa692064262f3c0e10cfa5e4b1ec8c86e5d02362 --- includes/CategoryViewer.php | 43 ++++++++++---------- includes/EditPage.php | 2 +- includes/Preferences.php | 2 +- includes/ProtectionForm.php | 4 +- includes/Skin.php | 3 +- includes/SkinTemplate.php | 2 +- includes/User.php | 3 +- includes/UserMailer.php | 13 +++--- includes/actions/InfoAction.php | 11 +++-- includes/installer/CliInstaller.php | 5 +-- includes/installer/DatabaseInstaller.php | 4 +- includes/installer/Installer.php | 4 +- includes/installer/WebInstaller.php | 17 ++++---- includes/installer/WebInstallerPage.php | 29 +++++++------ includes/job/jobs/DoubleRedirectJob.php | 21 +++++----- includes/specials/SpecialJavaScriptTest.php | 4 +- includes/specials/SpecialProtectedpages.php | 10 ++--- includes/specials/SpecialProtectedtitles.php | 6 +-- includes/specials/SpecialUserrights.php | 15 ++++--- languages/Language.php | 3 +- 20 files changed, 100 insertions(+), 101 deletions(-) diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 5b6694fb0a..55d9c1e524 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -660,20 +660,20 @@ class CategoryViewer extends ContextSource { * @param int $rescnt The number of items returned by our database query. * @param int $dbcnt The number of items according to the category table. * @param string $type 'subcat', 'article', or 'file' - * @return String: A message giving the number of items, to output to HTML. + * @return string: A message giving the number of items, to output to HTML. */ private function getCountMessage( $rescnt, $dbcnt, $type ) { - # There are three cases: - # 1) The category table figure seems sane. It might be wrong, but - # we can't do anything about it if we don't recalculate it on ev- - # ery category view. - # 2) The category table figure isn't sane, like it's smaller than the - # number of actual results, *but* the number of results is less - # than $this->limit and there's no offset. In this case we still - # know the right figure. - # 3) We have no idea. - - # Check if there's a "from" or "until" for anything + // There are three cases: + // 1) The category table figure seems sane. It might be wrong, but + // we can't do anything about it if we don't recalculate it on ev- + // ery category view. + // 2) The category table figure isn't sane, like it's smaller than the + // number of actual results, *but* the number of results is less + // than $this->limit and there's no offset. In this case we still + // know the right figure. + // 3) We have no idea. + + // Check if there's a "from" or "until" for anything // This is a little ugly, but we seem to use different names // for the paging types then for the messages. @@ -693,23 +693,22 @@ class CategoryViewer extends ContextSource { if ( $dbcnt == $rescnt || ( ( $rescnt == $this->limit || $fromOrUntil ) && $dbcnt > $rescnt ) ) { - # Case 1: seems sane. + // Case 1: seems sane. $totalcnt = $dbcnt; } elseif ( $rescnt < $this->limit && !$fromOrUntil ) { - # Case 2: not sane, but salvageable. Use the number of results. - # Since there are fewer than 200, we can also take this opportunity - # to refresh the incorrect category table entry -- which should be - # quick due to the small number of entries. + // Case 2: not sane, but salvageable. Use the number of results. + // Since there are fewer than 200, we can also take this opportunity + // to refresh the incorrect category table entry -- which should be + // quick due to the small number of entries. $totalcnt = $rescnt; $this->cat->refreshCounts(); } else { - # Case 3: hopeless. Don't give a total count at all. - # Give grep a chance to find the usages: category-subcat-count-limited, - # category-article-count-limited, category-file-count-limited + // Case 3: hopeless. Don't give a total count at all. + // Messages: category-subcat-count-limited, category-article-count-limited, + // category-file-count-limited return $this->msg( "category-$type-count-limited" )->numParams( $rescnt )->parseAsBlock(); } - # Give grep a chance to find the usages: - # category-subcat-count, category-article-count, category-file-count + // Messages: category-subcat-count, category-article-count, category-file-count return $this->msg( "category-$type-count" )->numParams( $rescnt, $totalcnt )->parseAsBlock(); } } diff --git a/includes/EditPage.php b/includes/EditPage.php index ec9f6ba2e2..63e3e66826 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -972,7 +972,7 @@ class EditPage { $undoMsg = 'norev'; } - // Give grep a chance to find the usages: undo-success, undo-failure, undo-norev + // Messages: undo-success, undo-failure, undo-norev $class = ( $undoMsg == 'success' ? '' : 'error ' ) . "mw-undo-{$undoMsg}"; $this->editFormPageTop .= $wgOut->parse( "
" . wfMessage( 'undo-' . $undoMsg )->plain() . '
', true, /* interface */true ); diff --git a/includes/Preferences.php b/includes/Preferences.php index 84a3b7ef0d..fc13a65dc7 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -987,7 +987,7 @@ class Preferences { foreach ( $watchTypes as $action => $pref ) { if ( $user->isAllowed( $action ) ) { - // Give grep a chance to find the usages: + // Messages: // tog-watchdefault, tog-watchmoves, tog-watchdeletion, tog-watchcreations $defaultPreferences[$pref] = array( 'type' => 'toggle', diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index fa02fb8d46..061ed2cdbe 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -363,9 +363,9 @@ class ProtectionForm { Xml::openElement( 'table', array( 'id' => 'mwProtectSet' ) ) . Xml::openElement( 'tbody' ); + // Not all languages have V_x <-> N_x relation foreach ( $this->mRestrictions as $action => $selected ) { - /* Not all languages have V_x <-> N_x relation */ - // Give grep a chance to find the usages: + // Messages: // restriction-edit, restriction-move, restriction-create, restriction-upload $msg = wfMessage( 'restriction-' . $action ); $out .= "" . diff --git a/includes/Skin.php b/includes/Skin.php index b7148865dc..26cac585fe 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -82,8 +82,7 @@ abstract class Skin extends ContextSource { static function getSkinNameMessages() { $messages = array(); foreach ( self::getSkinNames() as $skinKey => $skinName ) { - // Give grep a chance to find the usages: - // skinname-cologneblue, skinname-monobook, skinname-modern, skinname-vector + // Messages: skinname-cologneblue, skinname-monobook, skinname-modern, skinname-vector $messages[] = "skinname-$skinKey"; } return $messages; diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 2739df311d..eafe2331e2 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -291,8 +291,8 @@ class SkinTemplate extends Skin { if ( $out->isSyndicated() ) { $feeds = array(); foreach ( $out->getSyndicationLinks() as $format => $link ) { - // Give grep a chance to find the usages: feed-atom, feed-rss $feeds[$format] = array( + // Messages: feed-atom, feed-rss 'text' => $this->msg( "feed-$format" )->text(), 'href' => $link ); diff --git a/includes/User.php b/includes/User.php index 25b35b34d9..f421237871 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3759,8 +3759,7 @@ class User { } elseif ( $type === true ) { $message = 'confirmemail_body_changed'; } else { - // Give grep a chance to find the usages: - // confirmemail_body_changed, confirmemail_body_set + // Messages: confirmemail_body_changed, confirmemail_body_set $message = 'confirmemail_body_' . $type; } diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 0c880d6f2a..8ab10b2d1a 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -751,14 +751,17 @@ class EmailNotification { # Replace this after transforming the message, bug 35019 $postTransformKeys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary; - # Now build message's subject and body - # Give grep a chance to find the usages: enotif_subject_deleted, enotif_subject_created, - # enotif_subject_moved, enotif_subject_restored, enotif_subject_changed + // Now build message's subject and body + + // Messages: + // enotif_subject_deleted, enotif_subject_created, enotif_subject_moved, + // enotif_subject_restored, enotif_subject_changed $this->subject = wfMessage( 'enotif_subject_' . $this->pageStatus )->inContentLanguage() ->params( $pageTitle, $keys['$PAGEEDITOR'] )->text(); - # Give grep a chance to find the usages: enotif_body_intro_deleted, enotif_body_intro_created, - # enotif_body_intro_moved, enotif_body_intro_restored, enotif_body_intro_changed + // Messages: + // enotif_body_intro_deleted, enotif_body_intro_created, enotif_body_intro_moved, + // enotif_body_intro_restored, enotif_body_intro_changed $keys['$PAGEINTRO'] = wfMessage( 'enotif_body_intro_' . $this->pageStatus ) ->inContentLanguage()->params( $pageTitle, $keys['$PAGEEDITOR'], $pageTitleUrl ) ->text(); diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 1fe19d575b..704dee48cb 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -116,7 +116,7 @@ class InfoAction extends FormlessAction { // Render page information foreach ( $pageInfo as $header => $infoTable ) { - // Give grep a chance to find the usages: + // Messages: // pageinfo-header-basic, pageinfo-header-edits, pageinfo-header-restrictions, // pageinfo-header-properties, pageinfo-category-info $content .= $this->makeHeader( $this->msg( "pageinfo-${header}" )->escaped() ) . "\n"; @@ -281,8 +281,8 @@ class InfoAction extends FormlessAction { // Use robot policy logic $policy = $this->page->getRobotPolicy( 'view', $pOutput ); - // Give grep a chance to find the usages: pageinfo-robot-index, pageinfo-robot-noindex $pageInfo['header-basic'][] = array( + // Messages: pageinfo-robot-index, pageinfo-robot-noindex $this->msg( 'pageinfo-robot-policy' ), $this->msg( "pageinfo-robot-${policy['index']}" ) ); @@ -397,8 +397,7 @@ class InfoAction extends FormlessAction { $message = $this->msg( 'protect-default' )->escaped(); } else { // Administrators only - // Give grep a chance to find the usages: - // protect-level-autoconfirmed, protect-level-sysop + // Messages: protect-level-autoconfirmed, protect-level-sysop $message = $this->msg( "protect-level-$protectionLevel" ); if ( $message->isDisabled() ) { // Require "$1" permission @@ -408,8 +407,8 @@ class InfoAction extends FormlessAction { } } - // Give grep a chance to find the usages: - // restriction-edit, restriction-move, restriction-create, restriction-upload + // Messages: restriction-edit, restriction-move, restriction-create, + // restriction-upload $pageInfo['header-restrictions'][] = array( $this->msg( "restriction-$restrictionType" ), $message ); diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index d4e19f6074..9f7ed7bc3e 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -137,9 +137,8 @@ class CliInstaller extends Installer { } public function startStage( $step ) { - // Give grep a chance to find the usages: config-install-database, config-install-tables, - // config-install-interwiki, config-install-stats, config-install-keys, config-install-sysop, - // config-install-mainpage + // Messages: config-install-database, config-install-tables, config-install-interwiki, + // config-install-stats, config-install-keys, config-install-sysop, config-install-mainpage $this->showMessage( "config-install-$step" ); } diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 13d5d425e0..ca4ef97792 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -335,8 +335,8 @@ abstract class DatabaseInstaller { * @return String */ public function getReadableName() { - // Give grep a chance to find the usages: - // config-type-mysql, config-type-postgres, config-type-sqlite, config-type-oracle + // Messages: config-type-mysql, config-type-postgres, config-type-sqlite, + // config-type-oracle return wfMessage( 'config-type-' . $this->getName() )->text(); } diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 04d2b20d7f..afd2e3dbaf 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -661,8 +661,8 @@ abstract class Installer { $allNames = array(); - // Give grep a chance to find the usages: - // config-type-mysql, config-type-postgres, config-type-oracle, config-type-sqlite + // Messages: config-type-mysql, config-type-postgres, config-type-oracle, + // config-type-sqlite foreach ( self::getDBTypes() as $name ) { $allNames[] = wfMessage( "config-type-$name" )->text(); } diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index da84316af2..9fcd312930 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -516,7 +516,7 @@ class WebInstaller extends Installer { /** * Called by execute() before page output starts, to show a page list. * - * @param $currentPageName String + * @param $currentPageName string */ private function startPageWrapper( $currentPageName ) { $s = "
\n"; @@ -539,8 +539,10 @@ class WebInstaller extends Installer { $s .= "
\n"; // end list pane - // Give grep a chance to find the usages: + // End list pane + $s .= "\n"; + + // Messages: // config-page-language, config-page-welcome, config-page-dbconnect, config-page-upgrade, // config-page-dbsettings, config-page-name, config-page-options, config-page-install, // config-page-complete, config-page-restart, config-page-readme, config-page-releasenotes, @@ -554,15 +556,16 @@ class WebInstaller extends Installer { /** * Get a list item for the page list. * - * @param $pageName String - * @param $enabled Boolean - * @param $currentPageName String + * @param $pageName string + * @param $enabled boolean + * @param $currentPageName string * * @return string */ private function getPageListItem( $pageName, $enabled, $currentPageName ) { $s = "
  • "; - // Give grep a chance to find the usages: + + // Messages: // config-page-language, config-page-welcome, config-page-dbconnect, config-page-upgrade, // config-page-dbsettings, config-page-name, config-page-options, config-page-install, // config-page-complete, config-page-restart, config-page-readme, config-page-releasenotes, diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index a01789469b..510ea6c6bb 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -74,6 +74,10 @@ abstract class WebInstallerPage { ); } + /** + * @param string|bool $continue + * @param string|bool $back + */ public function endForm( $continue = 'continue', $back = 'back' ) { $s = "
    \n"; $id = $this->getId(); @@ -84,14 +88,14 @@ abstract class WebInstallerPage { if ( $continue ) { // Fake submit button for enter keypress (bug 26267) - // Give grep a chance to find the usages: config-continue + // Messages: config-continue, config-restart, config-regenerate $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(), array( 'name' => "enter-$continue", 'style' => 'visibility:hidden;overflow:hidden;width:1px;margin:0' ) ) . "\n"; } if ( $back ) { - // Give grep a chance to find the usages: config-back + // Message: config-back $s .= Xml::submitButton( wfMessage( "config-$back" )->text(), array( 'name' => "submit-$back", @@ -100,7 +104,7 @@ abstract class WebInstallerPage { } if ( $continue ) { - // Give grep a chance to find the usages: config-continue + // Messages: config-continue, config-restart, config-regenerate $s .= Xml::submitButton( wfMessage( "config-$continue" )->text(), array( 'name' => "submit-$continue", @@ -457,8 +461,8 @@ class WebInstaller_DBConnect extends WebInstallerPage { $settings = ''; $defaultType = $this->getVar( 'wgDBtype' ); - // Give grep a chance to find the usages: - // config-support-mysql, config-support-postgres, config-support-oracle, config-support-sqlite + // Messages: config-support-mysql, config-support-postgres, config-support-oracle, + // config-support-sqlite $dbSupport = ''; foreach ( $this->parent->getDBTypes() as $type ) { $link = DatabaseBase::factory( $type )->getSoftwareLink(); @@ -488,8 +492,8 @@ class WebInstaller_DBConnect extends WebInstallerPage { ) . "
  • \n"; - // Give grep a chance to find the usages: - // config-header-mysql, config-header-postgres, config-header-oracle, config-header-sqlite + // Messages: config-header-mysql, config-header-postgres, config-header-oracle, + // config-header-sqlite $settings .= Html::openElement( 'div', array( 'id' => 'DB_wrapper_' . $type, 'class' => 'dbWrapper' ) ) . @@ -1131,10 +1135,10 @@ class WebInstaller_Options extends WebInstallerPage { return false; } } elseif ( in_array( $code, array_keys( $this->parent->licenses ) ) ) { - // Give grep a chance to find the usages: + // Messages: // config-license-cc-by, config-license-cc-by-sa, config-license-cc-by-nc-sa, - // config-license-cc-0, config-license-pd, config-license-gfdl, - // config-license-none, config-license-cc-choose + // config-license-cc-0, config-license-pd, config-license-gfdl, config-license-none, + // config-license-cc-choose $entry = $this->parent->licenses[$code]; if ( isset( $entry['text'] ) ) { $this->setVar( 'wgRightsText', $entry['text'] ); @@ -1219,9 +1223,8 @@ class WebInstaller_Install extends WebInstallerPage { } public function startStage( $step ) { - // Give grep a chance to find the usages: config-install-database, config-install-tables, - // config-install-interwiki, config-install-stats, config-install-keys, config-install-sysop, - // config-install-mainpage + // Messages: config-install-database, config-install-tables, config-install-interwiki, + // config-install-stats, config-install-keys, config-install-sysop, config-install-mainpage $this->addHTML( "
  • " . wfMessage( "config-install-$step" )->escaped() . wfMessage( 'ellipsis' )->escaped() ); if ( $step == 'extension-tables' ) { $this->startLiveBox(); diff --git a/includes/job/jobs/DoubleRedirectJob.php b/includes/job/jobs/DoubleRedirectJob.php index 918d9b327e..33e749b8fb 100644 --- a/includes/job/jobs/DoubleRedirectJob.php +++ b/includes/job/jobs/DoubleRedirectJob.php @@ -100,30 +100,30 @@ class DoubleRedirectJob extends Job { return true; } - # Check for a suppression tag (used e.g. in periodically archived discussions) + // Check for a suppression tag (used e.g. in periodically archived discussions) $mw = MagicWord::get( 'staticredirect' ); if ( $content->matchMagicWord( $mw ) ) { wfDebug( __METHOD__ . ": skipping: suppressed with __STATICREDIRECT__\n" ); return true; } - # Find the current final destination + // Find the current final destination $newTitle = self::getFinalDestination( $this->redirTitle ); if ( !$newTitle ) { wfDebug( __METHOD__ . ": skipping: single redirect, circular redirect or invalid redirect destination\n" ); return true; } if ( $newTitle->equals( $this->redirTitle ) ) { - # The redirect is already right, no need to change it - # This can happen if the page was moved back (say after vandalism) + // The redirect is already right, no need to change it + // This can happen if the page was moved back (say after vandalism) wfDebug( __METHOD__ . " : skipping, already good\n" ); } - # Preserve fragment (bug 14904) + // Preserve fragment (bug 14904) $newTitle = Title::makeTitle( $newTitle->getNamespace(), $newTitle->getDBkey(), $currentDest->getFragment(), $newTitle->getInterwiki() ); - # Fix the text + // Fix the text $newContent = $content->updateRedirect( $newTitle ); if ( $newContent->equals( $content ) ) { @@ -137,13 +137,13 @@ class DoubleRedirectJob extends Job { return false; } - # Save it + // Save it global $wgUser; $oldUser = $wgUser; $wgUser = $user; $article = WikiPage::factory( $this->title ); - // Give grep a chance to find the usages: - // double-redirect-fixed-move, double-redirect-fixed-maintenance + + // Messages: double-redirect-fixed-move, double-redirect-fixed-maintenance $reason = wfMessage( 'double-redirect-fixed-' . $this->reason, $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText() )->inContentLanguage()->text(); @@ -163,7 +163,8 @@ class DoubleRedirectJob extends Job { public static function getFinalDestination( $title ) { $dbw = wfGetDB( DB_MASTER ); - $seenTitles = array(); # Circular redirect check + // Circular redirect check + $seenTitles = array(); $dest = false; while ( true ) { diff --git a/includes/specials/SpecialJavaScriptTest.php b/includes/specials/SpecialJavaScriptTest.php index 5f4c1d28f2..7069d5270e 100644 --- a/includes/specials/SpecialJavaScriptTest.php +++ b/includes/specials/SpecialJavaScriptTest.php @@ -62,9 +62,9 @@ class SpecialJavaScriptTest extends SpecialPage { $out->addHtml( $summary ); } elseif ( isset( self::$frameworks[$framework] ) ) { // Matched! Display proper title and initialize the framework - // Give grep a chance to find the usages: javascripttest-qunit-name $out->setPageTitle( $this->msg( 'javascripttest-title', + // Messages: javascripttest-qunit-name $this->msg( "javascripttest-$framework-name" )->plain() ) ); $out->setSubtitle( $this->msg( 'javascripttest-backlink' ) @@ -93,12 +93,12 @@ class SpecialJavaScriptTest extends SpecialPage { private function getFrameworkListHtml() { $list = '