Use (int) rather than intval()
[lhc/web/wiklou.git] / includes / api / ApiFeedWatchlist.php
index 37ec3cf..935bb09 100644 (file)
@@ -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' ) )
@@ -193,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 );
                }