aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/diff
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-11-28 16:34:28 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-11-28 16:34:28 +0000
commit149f92896345b1fd873a814721b6e042a8681593 (patch)
treeb7b8dbe58bdd6aba31fcc12c7e92d55b6ae12749 /phpBB/includes/diff
parentff2b4e4e8f319e9c7346d33a79a3e1458464b7e8 (diff)
downloadforums-149f92896345b1fd873a814721b6e042a8681593.tar
forums-149f92896345b1fd873a814721b6e042a8681593.tar.gz
forums-149f92896345b1fd873a814721b6e042a8681593.tar.bz2
forums-149f92896345b1fd873a814721b6e042a8681593.tar.xz
forums-149f92896345b1fd873a814721b6e042a8681593.zip
begin working on getting this thing a bit faster. I need to finish the other calls, this commit actually will break the diff engine and the updater. The speed increase noticed is from 89 seconds to 22 seconds as well as saving a lot of memory.
git-svn-id: file:///svn/phpbb/trunk@6692 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/diff')
-rw-r--r--phpBB/includes/diff/diff.php11
-rw-r--r--phpBB/includes/diff/engine.php5
2 files changed, 12 insertions, 4 deletions
diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php
index ca8d16fd3e..59124ae7ef 100644
--- a/phpBB/includes/diff/diff.php
+++ b/phpBB/includes/diff/diff.php
@@ -46,10 +46,17 @@ 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_lines, $to_lines)
+ function diff(&$from_content, &$to_content)
{
$diff_engine = &new diff_engine();
- $this->_edits = call_user_func_array(array($diff_engine, 'diff'), array($from_lines, $to_lines));
+
+ $match = array('#\r\n?#', "#([\n]+){2,}#u");
+ $replace = array("\n", "\n");
+
+ $from_content = preg_replace($match, $replace, $from_content);
+ $to_content = preg_replace($match, $replace, $to_content);
+
+ $this->_edits = call_user_func_array(array($diff_engine, 'diff'), array(explode("\n", $from_content), explode("\n", $to_content)));
}
/**
diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php
index 5fcb317dd5..e7740a0584 100644
--- a/phpBB/includes/diff/engine.php
+++ b/phpBB/includes/diff/engine.php
@@ -49,8 +49,9 @@ class diff_engine
{
function diff($from_lines, $to_lines)
{
- array_walk($from_lines, array('diff', 'trim_newlines'));
- array_walk($to_lines, array('diff', 'trim_newlines'));
+ // Remove empty lines...
+// array_walk($from_lines, array('diff', 'trim_newlines'));
+// array_walk($to_lines, array('diff', 'trim_newlines'));
$n_from = sizeof($from_lines);
$n_to = sizeof($to_lines);