From d304ded241c93607181ff7c798f319cde39b7288 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 13 Nov 2006 14:29:18 +0000 Subject: [PATCH] Fixed EDIT_AUTOSUMMARY use, what did you think it was for? Fixed division by zero. --- includes/Article.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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); } } -- 2.20.1