From: Brad Jorsch Date: Fri, 10 Jul 2015 14:04:10 +0000 (-0400) Subject: ApiFeedWatchlist: Handle revdel X-Git-Tag: 1.31.0-rc.0~10820^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=21defc7fd62dc94baabc0d7af2b0db75e7aa5383;p=lhc%2Fweb%2Fwiklou.git ApiFeedWatchlist: Handle revdel We might get back rows with no title (log entries with deleted action) or no user (anything with deleted user). Don't raise warnings for those. Bug: T105367 Change-Id: I64b4fba478b3e1e86854843965b2ea2b5c1d7933 --- diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 853b138379..0ddb3c3870 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -169,6 +169,11 @@ class ApiFeedWatchlist extends ApiBase { * @return FeedItem */ private function createFeedItem( $info ) { + if ( !isset( $info['title'] ) ) { + // Probably a revdeled log entry, skip it. + return null; + } + $titleStr = $info['title']; $title = Title::newFromText( $titleStr ); $curidParam = array(); @@ -205,9 +210,14 @@ class ApiFeedWatchlist extends ApiBase { } $timestamp = $info['timestamp']; - $user = $info['user']; - $completeText = "$comment ($user)"; + if ( isset( $info['user'] ) ) { + $user = $info['user']; + $completeText = "$comment ($user)"; + } else { + $user = ''; + $completeText = (string)$comment; + } return new FeedItem( $titleStr, $completeText, $titleUrl, $timestamp, $user ); }