- $flags = explode( ',', $row->old_flags );
- if ( in_array( 'object', $flags )
- && substr( $row->old_text, 0, strlen( STUB_HEADER ) ) === STUB_HEADER )
- {
- resolveStub( $id, $row->old_text, $row->old_flags );
+ $text = $row->old_text;
+ if ( $row->old_flags === '' ) {
+ $flags = 'external';
+ } else {
+ $flags = "{$row->old_flags},external";
+ }
+
+ if ( strpos( $flags, 'object' ) !== false ) {
+ $obj = unserialize( $text );
+ $className = strtolower( get_class( $obj ) );
+ if ( $className == 'historyblobstub' ) {
+ resolveStub( $id, $row->old_text, $row->old_flags );
+ continue;
+ } elseif ( $className == 'historyblobcurstub' ) {
+ $text = gzdeflate( $obj->getText() );
+ $flags = 'utf-8,gzip,external';
+ } elseif ( $className == 'concatenatedgziphistoryblob' ) {
+ // Do nothing
+ } else {
+ print "Warning: unrecognised object class \"$className\"\n";
+ continue;
+ }
+ }
+
+ if ( strlen( $text ) < 100 ) {
+ // Don't move tiny revisions