X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHistoryBlob.php;h=664ceb4f06a81bd797c359348c4cd477f0d078c4;hb=154ac6816775059fcb1d784b0f59c8f4e2692a02;hp=323d10745b5625b744619eeea2bf22fec60dbf64;hpb=225ff51e0930589a5e6e6899f4a47b6f6af98cfa;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 323d10745b..664ceb4f06 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -355,7 +355,7 @@ class DiffHistoryBlob implements HistoryBlob { } function compress() { - if ( !function_exists( 'xdiff_string_bdiff' ) ){ + if ( !function_exists( 'xdiff_string_rabdiff' ) ){ throw new MWException( "Need xdiff 1.5+ support to write DiffHistoryBlob\n" ); } if ( isset( $this->mDiffs ) ) { @@ -430,7 +430,7 @@ class DiffHistoryBlob implements HistoryBlob { # Need to do a null concatenation with warnings off, due to bugs in the current version of xdiff # "String is not zero-terminated" wfSuppressWarnings(); - $diff = xdiff_string_bdiff( $t1, $t2 ) . ''; + $diff = xdiff_string_rabdiff( $t1, $t2 ) . ''; wfRestoreWarnings(); return $diff; } @@ -456,7 +456,7 @@ class DiffHistoryBlob implements HistoryBlob { } } if ( $header['csize'] != strlen( $base ) ) { - wfDebug( __METHOD__. ": incorrect base length {$header['csize']} -> {strlen($base)}\n" ); + wfDebug( __METHOD__. ": incorrect base length\n" ); return false; } @@ -547,14 +547,23 @@ class DiffHistoryBlob implements HistoryBlob { if ( isset( $info['default'] ) ) { $this->mDefaultKey = $info['default']; } - $map = explode( ',', $info['map'] ); - $cur = 0; - $this->mDiffMap = array(); - foreach ( $map as $i ) { - $cur += $i; - $this->mDiffMap[] = $cur; - } $this->mDiffs = $info['diffs']; + if ( isset( $info['base'] ) ) { + // Old format + $this->mDiffMap = range( 0, count( $this->mDiffs ) - 1 ); + array_unshift( $this->mDiffs, + pack( 'VVCV', 0, 0, self::XDL_BDOP_INSB, strlen( $info['base'] ) ) . + $info['base'] ); + } else { + // New format + $map = explode( ',', $info['map'] ); + $cur = 0; + $this->mDiffMap = array(); + foreach ( $map as $i ) { + $cur += $i; + $this->mDiffMap[] = $cur; + } + } $this->uncompress(); }