r40927 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40926‎ | r40927 | r40928 >
Date:19:19, 16 September 2008
Author:demon
Status:old
Tags:
Comment:
Remove two useless classes from HTMLDiff. One was entirely unused and useless, and the other was a wrapper for a more simple solution.
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/diff/HTMLDiff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/HTMLDiff.php
@@ -252,21 +252,21 @@
253253 $result = $acthis->getResult($acother);
254254 unset($acthis, $acother);
255255
256 - if ($result->changed) {
 256+ if ( $result ) {
257257 $mod = new Modification(Modification::CHANGED);
258258
259259 if (!$this->changedIDUsed) {
260260 $mod->firstOfID = true;
261 - } else if (!is_null($result->changes) && $result->changes !== $this->changes) {
 261+ } else if (!is_null( $result ) && $result !== $this->changes) {
262262 ++$this->changedID;
263263 $mod->firstOfID = true;
264264 }
265265
266 - $mod->changes = $result->changes;
 266+ $mod->changes = $result;
267267 $mod->id = $this->changedID;
268268
269269 $this->textNodes[$i]->modification = $mod;
270 - $this->changes = $result->changes;
 270+ $this->changes = $result;
271271 $this->changedIDUsed = true;
272272 } else if ($this->changedIDUsed) {
273273 ++$this->changedID;
@@ -588,13 +588,6 @@
589589 }
590590 }
591591
592 -class AncestorComparatorResult {
593 -
594 - public $changed = false;
595 -
596 - public $changes = "";
597 -}
598 -
599592 /**
600593 * A comparator used when calculating the difference in ancestry of two Nodes.
601594 */
@@ -611,20 +604,16 @@
612605 public $compareTxt = "";
613606
614607 public function getResult(AncestorComparator $other) {
615 - $result = new AncestorComparatorResult();
616608
617609 $diffengine = new WikiDiff3(10000, 1.35);
618610 $differences = $diffengine->diff_range($other->ancestorsText,$this->ancestorsText);
619611
620612 if (count($differences) == 0){
621 - return $result;
 613+ return null;
622614 }
623615 $changeTxt = new ChangeTextGenerator($this, $other);
624616
625 - $result->changed = true;
626 - $result->changes = $changeTxt->getChanged($differences)->toString();
627 -
628 - return $result;
 617+ return $changeTxt->getChanged($differences)->toString();;
629618 }
630619 }
631620
@@ -990,26 +979,6 @@
991980 }
992981 }
993982
994 -class EchoingContentHandler {
995 -
996 - function startElement($qname, /*array*/ $arguments) {
997 - echo Xml::openElement($qname, $arguments);
998 - }
999 -
1000 - function endElement($qname){
1001 - echo Xml::closeElement($qname);
1002 - }
1003 -
1004 - function characters($chars){
1005 - echo htmlspecialchars($chars);
1006 - }
1007 -
1008 - function html($html){
1009 - echo $html;
1010 - }
1011 -
1012 -}
1013 -
1014983 class DelegatingContentHandler {
1015984
1016985 private $delegate;
Index: trunk/phase3/includes/AutoLoader.php
@@ -316,7 +316,6 @@
317317
318318 # includes/diff
319319 'AncestorComparator' => 'includes/diff/HTMLDiff.php',
320 - 'AncestorComparatorResult' => 'includes/diff/HTMLDiff.php',
321320 'AnchorToString' => 'includes/diff/HTMLDiff.php',
322321 'ArrayDiffFormatter' => 'includes/diff/DifferenceEngine.php',
323322 'BodyNode' => 'includes/diff/Nodes.php',
@@ -334,7 +333,6 @@
335334 '_DiffOp' => 'includes/diff/DifferenceEngine.php',
336335 'DomTreeBuilder' => 'includes/diff/HTMLDiff.php',
337336 'DummyNode' => 'includes/diff/Nodes.php',
338 - 'EchoingContentHandler' => 'includes/diff/HTMLDiff.php',
339337 'HTMLDiffer' => 'includes/diff/HTMLDiff.php',
340338 'HTMLOutput' => 'includes/diff/HTMLDiff.php',
341339 '_HWLDF_WordAccumulator' => 'includes/diff/DifferenceEngine.php',

Status & tagging log