[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: Choose more magical magic

2017-10-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/383895 )

Change subject: Choose more magical magic
..


Choose more magical magic

Empty array was returned in the legitimate case where nothing needs to be
fetched from the thresholds API, so I've changed the magic to a number, which
can never be returned by normal code.

Bug: T175053
Change-Id: If8064ddd4b229c090c3747698b83106aee17845b
---
M includes/Stats.php
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/includes/Stats.php b/includes/Stats.php
index ab05320..8409ff3 100644
--- a/includes/Stats.php
+++ b/includes/Stats.php
@@ -95,13 +95,13 @@
return 
$this->fetchStatsFromApi( $model );
} catch ( \RuntimeException $ex ) {
// Magic to trigger an 
exception.
-   return [];
+   return -1;
}
}
);
// @deprecated Magic exception to allow caching of 
failure and
// falling back to StatsV1.
-   if ( count( $result ) === 0 ) {
+   if ( $result === -1 ) {
throw new \RuntimeException( 'Cached failure.' 
);
}
return $result;

-- 
To view, visit https://gerrit.wikimedia.org/r/383895
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If8064ddd4b229c090c3747698b83106aee17845b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Awight 
Gerrit-Reviewer: Awight 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: Jforrester 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...ORES[master]: Choose more magical magic

2017-10-12 Thread Awight (Code Review)
Awight has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383895 )

Change subject: Choose more magical magic
..

Choose more magical magic

Empty array was returned in the legitimate case where nothing needs to be
fetched from the thresholds API, so I've changed the magic to a number, which
can never be returned by normal code.

Bug: T175053
Change-Id: If8064ddd4b229c090c3747698b83106aee17845b
---
M includes/Stats.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES 
refs/changes/95/383895/1

diff --git a/includes/Stats.php b/includes/Stats.php
index ab05320..8409ff3 100644
--- a/includes/Stats.php
+++ b/includes/Stats.php
@@ -95,13 +95,13 @@
return 
$this->fetchStatsFromApi( $model );
} catch ( \RuntimeException $ex ) {
// Magic to trigger an 
exception.
-   return [];
+   return -1;
}
}
);
// @deprecated Magic exception to allow caching of 
failure and
// falling back to StatsV1.
-   if ( count( $result ) === 0 ) {
+   if ( $result === -1 ) {
throw new \RuntimeException( 'Cached failure.' 
);
}
return $result;

-- 
To view, visit https://gerrit.wikimedia.org/r/383895
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8064ddd4b229c090c3747698b83106aee17845b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Awight 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits