Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/191578
Change subject: Hygiene: Don't assume, that all pages has text extracts
......................................................................
Hygiene: Don't assume, that all pages has text extracts
E.g. if you have nonexistent pages in your watchlist, they never has
an extracts key in Api return.
Change-Id: Ifb29cfa8151f2fe0d9d656cdeb9c196cccf57f18
---
M includes/stores/ItemExtracts.php
M includes/stores/WatchlistCollection.php
2 files changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather
refs/changes/78/191578/1
diff --git a/includes/stores/ItemExtracts.php b/includes/stores/ItemExtracts.php
index 3a766b0..cd9dcfb 100644
--- a/includes/stores/ItemExtracts.php
+++ b/includes/stores/ItemExtracts.php
@@ -35,7 +35,9 @@
$extracts = array();
foreach ( $pages as $page ) {
- $extracts[] = $page['extract']['*'];
+ if ( isset( $page['extract']['*'] ) ) {
+ $extracts[] = $page['extract']['*'];
+ }
}
return $extracts;
}
diff --git a/includes/stores/WatchlistCollection.php
b/includes/stores/WatchlistCollection.php
index ac40dfe..14044cb 100644
--- a/includes/stores/WatchlistCollection.php
+++ b/includes/stores/WatchlistCollection.php
@@ -47,7 +47,11 @@
// Merge the data into models\CollectionItem
$items = array();
foreach ( $titles as $key=>$title ) {
- $items[] = new models\CollectionItem( $title,
$images[$key], $extracts[$key] );
+ $items[] = new models\CollectionItem(
+ $title,
+ $images[$key],
+ ( isset( $extracts[$key] ) ? $extracts[$key] :
'' )
+ );
}
// Construct the internal models\Collection
--
To view, visit https://gerrit.wikimedia.org/r/191578
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb29cfa8151f2fe0d9d656cdeb9c196cccf57f18
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits