aboutsummaryrefslogtreecommitdiff
path: root/scripts/pagerev.php
diff options
context:
space:
mode:
authorpetko <petko@524c5546-5005-0410-9a3e-e25e191bd360>2011-09-09 19:17:39 +0000
committerpetko <petko@524c5546-5005-0410-9a3e-e25e191bd360>2011-09-09 19:17:39 +0000
commit9db52b9d5d21f1da762135effd7f46bffdf8bcbf (patch)
treed7aca2a5b46836a727c66a446112985f2b65a94c /scripts/pagerev.php
parent5b23ccc685da216b17f7d678ff33d7b214677e31 (diff)
downloadpmwiki.svn-9db52b9d5d21f1da762135effd7f46bffdf8bcbf.tar.bz2
Faster DiffRenderSource() when a huge number of lines is deleted or added, eg. fixing spam/deface of large pages.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@2687 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'scripts/pagerev.php')
-rw-r--r--scripts/pagerev.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/pagerev.php b/scripts/pagerev.php
index 9613fc97..f1bdbfeb 100644
--- a/scripts/pagerev.php
+++ b/scripts/pagerev.php
@@ -163,14 +163,15 @@ function DiffRenderSource($in, $out, $which) {
$a = $which? $out : $in;
return str_replace("\n","<br />",htmlspecialchars(join("\n",$a)));
}
+ $countdifflines = abs(count($in)-count($out));
$lines = $cnt = $x2 = $y2 = array();
foreach($in as $line) {
- $tmp = DiffPrepareInline($line);
+ $tmp = $countdifflines>20 ? array($line) : DiffPrepareInline($line);
if(!$which) $cnt[] = array(count($x2), count($tmp));
$x2 = array_merge($x2, $tmp);
}
foreach($out as $line) {
- $tmp = DiffPrepareInline($line);
+ $tmp = $countdifflines>20 ? array($line) : DiffPrepareInline($line);
if($which) $cnt[] = array(count($y2), count($tmp));
$y2 = array_merge($y2, $tmp);
}