r105810 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105809‎ | r105810 | r105811 >
Date:18:31, 11 December 2011
Author:yuvipanda
Status:deferred (Comments)
Tags:
Comment:
Removed usages of empty()

/me tends to wounds on foot
Modified paths:
  • /trunk/extensions/SelectionSifter/SelectionSifter.hooks.php (modified) (history)
  • /trunk/extensions/SelectionSifter/models/Rating.php (modified) (history)
  • /trunk/extensions/SelectionSifter/models/Statistics.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SelectionSifter/models/Rating.php
@@ -152,18 +152,4 @@
153153 );
154154 // Article moves not logged - yet
155155 }
156 -
157 - private static function checkArticle( $article, $category_filters ) {
158 - // Check category
159 - if( count( $category_filters ) == 0 || ( count($category_filters) == 1 && empty( $category_filters[0] ) ) ) {
160 - return true;
161 - }
162 -
163 - foreach( $category_filters as $category ) {
164 - if( in_array( $category, $article['categories'] ) ) {
165 - return true;
166 - }
167 - }
168 - return false;
169 - }
170156 }
Index: trunk/extensions/SelectionSifter/models/Statistics.php
@@ -19,7 +19,7 @@
2020 }
2121
2222 public static function updateAggregateStats( $rating, $is_new_rating, $update_global = true ) {
23 - if(! $is_new_rating && empty($rating->old_importance) && empty($rating->old_quality) ) {
 23+ if(! $is_new_rating && !isset($rating->old_importance) && !isset($rating->old_quality) ) {
2424 return;
2525 }
2626 $dbw = wfGetDB( DB_MASTER );
@@ -46,12 +46,12 @@
4747
4848 if(! $is_new_rating ) {
4949 // Is not a new rating, and atleast one of quality or importance has changed
50 - if(! empty( $rating->old_quality ) ) {
 50+ if( isset( $rating->old_quality ) ) {
5151 $q_value = $rating->old_quality;
5252 } else {
5353 $q_value = $rating->quality;
5454 }
55 - if(! empty( $rating->old_importance) ) {
 55+ if( isset( $rating->old_importance) ) {
5656 $i_column = Statistics::getImportanceColumn( $rating->old_importance );
5757 } else {
5858 $i_column = Statistics::getImportanceColumn( $rating->importance );
Index: trunk/extensions/SelectionSifter/SelectionSifter.hooks.php
@@ -34,7 +34,7 @@
3535 $rating->saveAll();
3636
3737 $timestamp = wfTimestamp( TS_MW );
38 - if( !empty( $assessment['quality'] ) ) {
 38+ if( isset( $assessment['quality'] ) ) {
3939 AssessmentChangeLog::makeEntry(
4040 $project,
4141 $main_title->getNamespace(),
@@ -45,7 +45,7 @@
4646 $assessment['quality']
4747 );
4848 }
49 - if( !empty( $assessment['importance'] ) ) {
 49+ if( isset( $assessment['importance'] ) ) {
5050 AssessmentChangeLog::makeEntry(
5151 $project,
5252 $main_title->getNamespace(),

Comments

#Comment by Johnduhart (talk | contribs)   18:40, 11 December 2011
-
-	private static function checkArticle( $article, $category_filters ) {
-		// Check category
-		if( count( $category_filters ) == 0 || ( count($category_filters) == 1 && empty( $category_filters[0] ) ) ) {
-			return true;
-		}
-
-		foreach( $category_filters as $category ) {
-			if( in_array( $category, $article['categories'] ) ) {
-				return true;
-			}
-		}
-		return false;
-	}

Whoah why'd this go? That wasn't in the commit summary.

#Comment by YuviPanda (talk | contribs)   18:52, 11 December 2011

Was dead code. Will make sure I have more 'complete' commit summaries

Status & tagging log