Download & Extend

Compare and merge PhpWiki diff*.php with MediaWiki's DairikiDiff.php and DiffEngine.php

Project:Drupal core
Version:8.x-dev
Component:base system
Category:task
Priority:normal
Assigned:sun
Status:postponed
Issue tags:diff

Issue Summary

Follow-up to:
#120955: Integrate Diff into Core

Steps

  1. Compare DiffEngine.php with PhpWiki's original diff*.php files. Document all differences.
  2. Compare and merge DiffEngine.php with improvements in MediaWiki's DairikiDiff.php.
  3. Commit combined improvements.

Postponed until feature freeze. No reason to work on that before.

Change records for this issue

Comments

#1

The only change of significance that I could see with the core Diff classes is below. I only compared the classes from the introduction of the file in 4.7. This was added between 7.x-2.x and 7.x-3.x and was done to introduce a way to count lines across multiple calls to the DiffFormatter class

<?php
class DiffFormatter {
// This was incorrectly defined in DrupalDiffFormatter...
+  var $line_stats = array(
+     
'counter' => array('x' => 0, 'y' => 0),
+     
'offset' => array('x' => 0, 'y' => 0),
+  );

  function
format($diff) {
.....
+
+    if (!empty(
$xi)) {
+     
$this->line_stats['counter']['x'] += $xi;
+    }
+    if (!empty(
$yi)) {
+     
$this->line_stats['counter']['y'] += $yi;
+    }
+
     return
$end;
   }
}
?>

As far as I could tell, all other changes were done in relation to coding standards, minor notices such as non-initialised variables, etc.