From: Sam Reed Date: Thu, 24 Feb 2011 16:00:06 +0000 (+0000) Subject: Followup r82727, improve comments, cast return value to bool X-Git-Tag: 1.31.0-rc.0~31792 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=28f7bf1f2bef920cc99c9807fb252c180c16c40a;p=lhc%2Fweb%2Fwiklou.git Followup r82727, improve comments, cast return value to bool --- diff --git a/includes/Article.php b/includes/Article.php index 1d8f68bd2c..9512ce1f18 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2431,6 +2431,9 @@ class Article { /** * Add this page to $wgUser's watchlist + * + * This is safe to be called multiple times + * * @return bool true on successful watch operation */ public function doWatch() { diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index bd6f74e5f6..e761fbd246 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -602,8 +602,8 @@ abstract class ApiBase { $userOption = $titleObj->exists() ? 'watchdefault' : 'watchcreations'; } - # If the corresponding user option is true, watch, don't - return $wgUser->getOption( $userOption ) ? true : false; + # Watch the article based on the user preference + return (bool)$wgUser->getOption( $userOption ); case 'nochange': return $userWatching;