r112043 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112042‎ | r112043 | r112044 >
Date:21:15, 21 February 2012
Author:reedy
Status:ok
Tags:
Comment:
Improve documentation

Fix whitespace


Fix weird conditional loading of DB_MASTER from specials/SpecialEditWatchlist.php
Modified paths:
  • /trunk/phase3/includes/Xml.php (modified) (history)
  • /trunk/phase3/includes/logging/LogEntry.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDeletedContributions.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialEditWatchlist.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Xml.php
@@ -213,13 +213,13 @@
214214 } else {
215215 $languages = Language::getLanguageNames( $customisedOnly );
216216 }
217 -
 217+
218218 // Make sure the site language is in the list; a custom language code might not have a
219219 // defined name...
220220 if( !array_key_exists( $wgLanguageCode, $languages ) ) {
221221 $languages[$wgLanguageCode] = $wgLanguageCode;
222222 }
223 -
 223+
224224 ksort( $languages );
225225
226226 /**
Index: trunk/phase3/includes/logging/LogEntry.php
@@ -495,6 +495,9 @@
496496 return $this->parameters;
497497 }
498498
 499+ /**
 500+ * @return User
 501+ */
499502 public function getPerformer() {
500503 return $this->performer;
501504 }
Index: trunk/phase3/includes/specials/SpecialEditWatchlist.php
@@ -297,9 +297,7 @@
298298 * Attempts to clean up broken items
299299 */
300300 private function cleanupWatchlist() {
301 - if ( count( $this->badItems ) ) {
302 - $dbw = wfGetDB( DB_MASTER );
303 - }
 301+ $dbw = wfGetDB( DB_MASTER );
304302 foreach ( $this->badItems as $row ) {
305303 list( $title, $namespace, $dbKey ) = $row;
306304 wfDebug( "User {$this->getUser()} has broken watchlist item ns($namespace):$dbKey, "
Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -229,7 +229,7 @@
230230 }
231231
232232 /**
233 - * @return false|string wgVersion + HEAD sha1 stripped to the first 7 chars
 233+ * @return bool|string wgVersion + HEAD sha1 stripped to the first 7 chars. False on failure
234234 */
235235 private static function getVersionLinkedGit() {
236236 global $wgVersion, $IP;
@@ -387,6 +387,8 @@
388388
389389 /**
390390 * Callback to sort extensions by type.
 391+ * @param $a array
 392+ * @param $b array
391393 * @return int
392394 */
393395 function compare( $a, $b ) {
@@ -621,6 +623,7 @@
622624 * url The subversion URL of the directory
623625 * repo-url The base URL of the repository
624626 * viewvc-url A ViewVC URL pointing to the checked-out revision
 627+ * @param $dir string
625628 * @return array|bool
626629 */
627630 public static function getSvnInfo( $dir ) {
@@ -711,7 +714,7 @@
712715
713716 /**
714717 * @param $dir String: directory of the git checkout
715 - * @return false|String sha1 of commit HEAD points to
 718+ * @return bool|String sha1 of commit HEAD points to
716719 */
717720 public static function getGitHeadSha1( $dir ) {
718721 $BASEDIR = "{$dir}/.git/";
@@ -722,19 +725,18 @@
723726 }
724727
725728 preg_match( "/ref: (.*)/",
726 - file_get_contents( $HEADfile), $m );
 729+ file_get_contents( $HEADfile), $m );
727730
728731 $REFfile = "{$BASEDIR}{$m[1]}";
729732 if( !file_exists( $REFfile ) ) {
730733 return false;
731734 }
732735
733 - $sha1 = chop(file_get_contents( $REFfile ));
 736+ $sha1 = rtrim( file_get_contents( $REFfile ) );
734737
735738 return $sha1;
736739 }
737740
738 -
739741 function showEasterEgg() {
740742 $rx = $rp = $xe = '';
741743 $alpha = array("", "kbQW", "\$\n()");
Index: trunk/phase3/includes/specials/SpecialDeletedContributions.php
@@ -25,7 +25,6 @@
2626 * Implements Special:DeletedContributions to display archived revisions
2727 * @ingroup SpecialPage
2828 */
29 -
3029 class DeletedContribsPager extends IndexPager {
3130 public $mDefaultDirection = true;
3231 var $messages, $target;
@@ -54,9 +53,9 @@
5554 $user = $this->getUser();
5655 // Paranoia: avoid brute force searches (bug 17792)
5756 if( !$user->isAllowed( 'deletedhistory' ) ) {
58 - $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0';
 57+ $conds[] = $this->mDb->bitAnd( 'ar_deleted', Revision::DELETED_USER ) . ' = 0';
5958 } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
60 - $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) .
 59+ $conds[] = $this->mDb->bitAnd( 'ar_deleted', Revision::SUPPRESSED_USER ) .
6160 ' != ' . Revision::SUPPRESSED_USER;
6261 }
6362 return array(
@@ -130,6 +129,7 @@
131130 * written by the target user.
132131 *
133132 * @todo This would probably look a lot nicer in a table.
 133+ * @param $row
134134 * @return string
135135 */
136136 function formatRow( $row ) {
@@ -346,6 +346,7 @@
347347 } else {
348348 $user = Linker::link( $userObj->getUserPage(), htmlspecialchars( $userObj->getName() ) );
349349 }
 350+ $links = '';
350351 $nt = $userObj->getUserPage();
351352 $id = $userObj->getID();
352353 $talk = $nt->getTalkPage();

Sign-offs

UserFlagDate
Nikerabbitinspected07:44, 22 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111643(bug 34420) - Special:Version should use git...hashar15:40, 16 February 2012

Status & tagging log