public $mMaxSize = 10000000;
public $mMaxCount = 100;
- /**
- * Constructor
- */
public function __construct() {
if ( !function_exists( 'gzdeflate' ) ) {
throw new MWException( "Need zlib support to read or write this "
function diff( $t1, $t2 ) {
# Need to do a null concatenation with warnings off, due to bugs in the current version of xdiff
# "String is not zero-terminated"
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$diff = xdiff_string_rabdiff( $t1, $t2 ) . '';
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
return $diff;
}
*/
function patch( $base, $diff ) {
if ( function_exists( 'xdiff_string_bpatch' ) ) {
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
$text = xdiff_string_bpatch( $base, $diff ) . '';
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
return $text;
}
$op = $x['op'];
++$p;
switch ( $op ) {
- case self::XDL_BDOP_INS:
- $x = unpack( 'Csize', substr( $diff, $p, 1 ) );
- $p++;
- $out .= substr( $diff, $p, $x['size'] );
- $p += $x['size'];
- break;
- case self::XDL_BDOP_INSB:
- $x = unpack( 'Vcsize', substr( $diff, $p, 4 ) );
- $p += 4;
- $out .= substr( $diff, $p, $x['csize'] );
- $p += $x['csize'];
- break;
- case self::XDL_BDOP_CPY:
- $x = unpack( 'Voff/Vcsize', substr( $diff, $p, 8 ) );
- $p += 8;
- $out .= substr( $base, $x['off'], $x['csize'] );
- break;
- default:
- wfDebug( __METHOD__ . ": invalid op\n" );
- return false;
+ case self::XDL_BDOP_INS:
+ $x = unpack( 'Csize', substr( $diff, $p, 1 ) );
+ $p++;
+ $out .= substr( $diff, $p, $x['size'] );
+ $p += $x['size'];
+ break;
+ case self::XDL_BDOP_INSB:
+ $x = unpack( 'Vcsize', substr( $diff, $p, 4 ) );
+ $p += 4;
+ $out .= substr( $diff, $p, $x['csize'] );
+ $p += $x['csize'];
+ break;
+ case self::XDL_BDOP_CPY:
+ $x = unpack( 'Voff/Vcsize', substr( $diff, $p, 8 ) );
+ $p += 8;
+ $out .= substr( $base, $x['off'], $x['csize'] );
+ break;
+ default:
+ wfDebug( __METHOD__ . ": invalid op\n" );
+ return false;
}
}
return $out;
}
}
+
+// phpcs:ignore Generic.CodeAnalysis.UnconditionalIfStatement.Found
+if ( false ) {
+ // Blobs generated by MediaWiki < 1.5 on PHP 4 were serialized with the
+ // class name coerced to lowercase. We can improve efficiency by adding
+ // autoload entries for the lowercase variants of these classes (T166759).
+ // The code below is never executed, but it is picked up by the AutoloadGenerator
+ // parser, which scans for class_alias() calls.
+ class_alias( ConcatenatedGzipHistoryBlob::class, 'concatenatedgziphistoryblob' );
+ class_alias( HistoryBlobCurStub::class, 'historyblobcurstub' );
+ class_alias( HistoryBlobStub::class, 'historyblobstub' );
+}