From e16a11ae169c224299138fb20dfb178ab4ff4637 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 21 Feb 2012 21:15:05 +0000 Subject: [PATCH] Improve documentation Fix whitespace Fix weird conditional loading of DB_MASTER from specials/SpecialEditWatchlist.php --- includes/Xml.php | 4 ++-- includes/logging/LogEntry.php | 3 +++ includes/specials/SpecialDeletedContributions.php | 7 ++++--- includes/specials/SpecialEditWatchlist.php | 4 +--- includes/specials/SpecialVersion.php | 12 +++++++----- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/includes/Xml.php b/includes/Xml.php index 3b043eb024..8135a70d7a 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -213,13 +213,13 @@ class Xml { } else { $languages = Language::getLanguageNames( $customisedOnly ); } - + // Make sure the site language is in the list; a custom language code might not have a // defined name... if( !array_key_exists( $wgLanguageCode, $languages ) ) { $languages[$wgLanguageCode] = $wgLanguageCode; } - + ksort( $languages ); /** diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 66f0611cb4..b2c4e1ba65 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -495,6 +495,9 @@ class ManualLogEntry extends LogEntryBase { return $this->parameters; } + /** + * @return User + */ public function getPerformer() { return $this->performer; } diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 6790352cf7..a097d90685 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -25,7 +25,6 @@ * Implements Special:DeletedContributions to display archived revisions * @ingroup SpecialPage */ - class DeletedContribsPager extends IndexPager { public $mDefaultDirection = true; var $messages, $target; @@ -54,9 +53,9 @@ class DeletedContribsPager extends IndexPager { $user = $this->getUser(); // Paranoia: avoid brute force searches (bug 17792) if( !$user->isAllowed( 'deletedhistory' ) ) { - $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0'; + $conds[] = $this->mDb->bitAnd( 'ar_deleted', Revision::DELETED_USER ) . ' = 0'; } elseif( !$user->isAllowed( 'suppressrevision' ) ) { - $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) . + $conds[] = $this->mDb->bitAnd( 'ar_deleted', Revision::SUPPRESSED_USER ) . ' != ' . Revision::SUPPRESSED_USER; } return array( @@ -130,6 +129,7 @@ class DeletedContribsPager extends IndexPager { * written by the target user. * * @todo This would probably look a lot nicer in a table. + * @param $row * @return string */ function formatRow( $row ) { @@ -346,6 +346,7 @@ class DeletedContributionsPage extends SpecialPage { } else { $user = Linker::link( $userObj->getUserPage(), htmlspecialchars( $userObj->getName() ) ); } + $links = ''; $nt = $userObj->getUserPage(); $id = $userObj->getID(); $talk = $nt->getTalkPage(); diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index a7e97c8f81..296c98f2c3 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -297,9 +297,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { * Attempts to clean up broken items */ private function cleanupWatchlist() { - if ( count( $this->badItems ) ) { - $dbw = wfGetDB( DB_MASTER ); - } + $dbw = wfGetDB( DB_MASTER ); foreach ( $this->badItems as $row ) { list( $title, $namespace, $dbKey ) = $row; wfDebug( "User {$this->getUser()} has broken watchlist item ns($namespace):$dbKey, " diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 97cfe77bd6..597863b207 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -229,7 +229,7 @@ class SpecialVersion extends SpecialPage { } /** - * @return false|string wgVersion + HEAD sha1 stripped to the first 7 chars + * @return bool|string wgVersion + HEAD sha1 stripped to the first 7 chars. False on failure */ private static function getVersionLinkedGit() { global $wgVersion, $IP; @@ -387,6 +387,8 @@ class SpecialVersion extends SpecialPage { /** * Callback to sort extensions by type. + * @param $a array + * @param $b array * @return int */ function compare( $a, $b ) { @@ -621,6 +623,7 @@ class SpecialVersion extends SpecialPage { * url The subversion URL of the directory * repo-url The base URL of the repository * viewvc-url A ViewVC URL pointing to the checked-out revision + * @param $dir string * @return array|bool */ public static function getSvnInfo( $dir ) { @@ -711,7 +714,7 @@ class SpecialVersion extends SpecialPage { /** * @param $dir String: directory of the git checkout - * @return false|String sha1 of commit HEAD points to + * @return bool|String sha1 of commit HEAD points to */ public static function getGitHeadSha1( $dir ) { $BASEDIR = "{$dir}/.git/"; @@ -722,19 +725,18 @@ class SpecialVersion extends SpecialPage { } preg_match( "/ref: (.*)/", - file_get_contents( $HEADfile), $m ); + file_get_contents( $HEADfile), $m ); $REFfile = "{$BASEDIR}{$m[1]}"; if( !file_exists( $REFfile ) ) { return false; } - $sha1 = chop(file_get_contents( $REFfile )); + $sha1 = rtrim( file_get_contents( $REFfile ) ); return $sha1; } - function showEasterEgg() { $rx = $rp = $xe = ''; $alpha = array("", "kbQW", "\$\n()"); -- 2.20.1