X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFeedWatchlist.php;h=935bb096ab011be63f805ccb8a637873241a2f00;hb=4691389fa46f79cbeaf2daffda407cf7daa66fd4;hp=c21ac12e821c4dc99003294a7117abd138e56b1f;hpb=f506a05aaa035b96537b33244b0f18b093048e97;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index c21ac12e82..935bb096ab 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -61,7 +61,7 @@ class ApiFeedWatchlist extends ApiBase { } // limit to the number of hours going from now back - $endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) ); + $endTime = wfTimestamp( TS_MW, time() - (int)$params['hours'] * 60 * 60 ); // Prepare parameters for nested request $fauxReqArr = [ @@ -69,7 +69,7 @@ class ApiFeedWatchlist extends ApiBase { 'meta' => 'siteinfo', 'siprop' => 'general', 'list' => 'watchlist', - 'wlprop' => 'title|user|comment|timestamp|ids', + 'wlprop' => 'title|user|comment|timestamp|ids|loginfo', 'wldir' => 'older', // reverse order - from newest to oldest 'wlend' => $endTime, // stop at this time 'wllimit' => min( 50, $this->getConfig()->get( 'FeedLimit' ) ) @@ -157,12 +157,8 @@ class ApiFeedWatchlist extends ApiBase { $feedItems[] = new FeedItem( $errorTitle, $errorText, '', '', '' ); } } else { - if ( $e instanceof UsageException ) { - $errorCode = $e->getCodeString(); - } else { - // Something is seriously wrong - $errorCode = 'internal_api_error'; - } + // Something is seriously wrong + $errorCode = 'internal_api_error'; $errorTitle = $this->msg( 'api-feed-error-title', $errorCode ); $errorText = $e->getMessage(); $feedItems[] = new FeedItem( $errorTitle, $errorText, '', '', '' ); @@ -197,7 +193,12 @@ class ApiFeedWatchlist extends ApiBase { } } if ( isset( $info['revid'] ) ) { - $titleUrl = $title->getFullURL( [ 'diff' => $info['revid'] ] ); + if ( $info['revid'] === 0 && isset( $info['logid'] ) ) { + $logTitle = Title::makeTitle( NS_SPECIAL, 'Log' ); + $titleUrl = $logTitle->getFullURL( [ 'logid' => $info['logid'] ] ); + } else { + $titleUrl = $title->getFullURL( [ 'diff' => $info['revid'] ] ); + } } else { $titleUrl = $title->getFullURL( $curidParam ); }