diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-29 15:51:54 +0000 | 
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-29 15:51:54 +0000 | 
| commit | 7ed41c4de14e5b454e8935c35edef4a0b3c400a9 (patch) | |
| tree | 6d3b94b57fc947d57ad19cdcfb2e617c001614ae /phpBB/includes/diff/diff.php | |
| parent | d417d53c0aceb79f18df31a372f78f9dc44519c7 (diff) | |
| download | forums-7ed41c4de14e5b454e8935c35edef4a0b3c400a9.tar forums-7ed41c4de14e5b454e8935c35edef4a0b3c400a9.tar.gz forums-7ed41c4de14e5b454e8935c35edef4a0b3c400a9.tar.bz2 forums-7ed41c4de14e5b454e8935c35edef4a0b3c400a9.tar.xz forums-7ed41c4de14e5b454e8935c35edef4a0b3c400a9.zip | |
updates for the updater and the diff engine.
- this update also includes an important change for including the diff engine, since we may need to include an updated engine before updating. This basically means that for a future update (B4 to another version) requires copying the new diff files first... the new include method should prevent this needed handwork for later versions then.
git-svn-id: file:///svn/phpbb/trunk@6695 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/diff/diff.php')
| -rw-r--r-- | phpBB/includes/diff/diff.php | 28 | 
1 files changed, 13 insertions, 15 deletions
| diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php index 430ae0f522..b18970dab4 100644 --- a/phpBB/includes/diff/diff.php +++ b/phpBB/includes/diff/diff.php @@ -15,10 +15,6 @@ if (!defined('IN_PHPBB'))  	exit;  } -// Include renderer and engine -include_once($phpbb_root_path . 'includes/diff/engine.' . $phpEx); -include_once($phpbb_root_path . 'includes/diff/renderer.' . $phpEx); -  /**  * Code from pear.php.net, Text_Diff-0.2.1 (beta) package  * http://pear.php.net/package/Text_Diff/ @@ -46,14 +42,10 @@ class diff  	* @param array $from_lines  An array of strings. Typically these are lines from a file.  	* @param array $to_lines    An array of strings.  	*/ -	function diff(&$from_content, &$to_content) +	function diff(&$from_content, &$to_content, $preserve_cr = true)  	{  		$diff_engine = &new diff_engine(); - -		$from_content = preg_replace('#[\n\r]+#', "\n", $from_content); -		$to_content = preg_replace('#[\n\r]+#', "\n", $to_content); - -		$this->_edits = call_user_func_array(array($diff_engine, 'diff'), array(explode("\n", $from_content), explode("\n", $to_content))); +		$this->_edits = $diff_engine->diff($from_content, $to_content, $preserve_cr);  	}  	/** @@ -252,7 +244,7 @@ class mapped_diff extends diff  	*                                  compared when computing the diff.  	* @param array $mapped_to_lines    This array should have the same number of elements as $to_lines.  	*/ -	function mapped_diff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) +	function mapped_diff(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines)  	{  		if (sizeof($from_lines) != sizeof($mapped_from_lines) || sizeof($to_lines) != sizeof($mapped_to_lines))  		{ @@ -418,10 +410,16 @@ class diff3 extends diff  	* @param array $final1  The first version to compare to.  	* @param array $final2  The second version to compare to.  	*/ -	function diff3($orig, $final1, $final2) +	function diff3(&$orig, &$final1, &$final2)  	{ -		$engine = new diff_engine(); -		$this->_edits = $this->_diff3($engine->diff($orig, $final1), $engine->diff($orig, $final2)); +		$diff_engine = &new diff_engine(); + +		$diff_1 = $diff_engine->diff($orig, $final1); +		$diff_2 = $diff_engine->diff($orig, $final2); + +		unset($engine); + +		$this->_edits = $this->_diff3($diff_1, $diff_2);  	}  	/** @@ -546,7 +544,7 @@ class diff3 extends diff  	/**  	* @access private  	*/ -	function _diff3($edits1, $edits2) +	function _diff3(&$edits1, &$edits2)  	{  		$edits = array();  		$bb = &new diff3_block_builder(); | 
