From: Tim Starling Date: Mon, 13 Nov 2006 14:29:18 +0000 (+0000) Subject: Fixed EDIT_AUTOSUMMARY use, what did you think it was for? Fixed division by zero. X-Git-Tag: 1.31.0-rc.0~55195 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=d304ded241c93607181ff7c798f319cde39b7288;p=lhc%2Fweb%2Fwiklou.git Fixed EDIT_AUTOSUMMARY use, what did you think it was for? Fixed division by zero. --- diff --git a/includes/Article.php b/includes/Article.php index 26129eb526..88fe3daf31 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1316,16 +1316,13 @@ class Article { return false; } - if (!$summary) { + if ($flags & EDIT_AUTOSUMMARY && $summary == '') { #If they're blanking an article, note it in the summary. - if (/*$flags & EDIT_AUTOSUMMARY && */$oldtext!='' && $text=='') { + if ($oldtext!='' && $text=='') { $summary = wfMsgForContent('autosumm-blank'); - } - - #Blanking and replacing with something short - if (strlen($oldtext) / strlen($text) > 10 && strlen($text) < 500) { #Removing more than 90% of the article + } elseif (strlen($oldtext) > 10 * strlen($text) && strlen($text) < 500) { #Removing more than 90% of the article global $wgContLang; - $truncatedtext = $wgContLang->truncate($text, 200 - strlen(wfMsg('autosumm-replace')), '...'); + $truncatedtext = $wgContLang->truncate($text, max(0, 200 - strlen(wfMsg('autosumm-replace'))), '...'); $summary = wfMsgForContent('autosumm-replace', $truncatedtext); } }