Code Duplication    Length = 20-20 lines in 2 locations

class/pcltar.lib.php 2 locations

@@ 883-902 (lines=20) @@
880
            $v_buffer = gzread($p_tar, 512);
881
882
            // ----- Read the following blocks but not the last one
883
            if (!gzeof($p_tar)) {
884
                TrFctMessage(__FILE__, __LINE__, 3, 'More than one 512 block file');
885
                $i = 1;
886
887
                // ----- Read new 512 block and write the already read
888
                do {
889
                    // ----- Write the already read block
890
                    $v_binary_data = pack('a512', "$v_buffer");
891
                    gzputs($v_temp_tar, $v_binary_data);
892
893
                    ++$i;
894
                    TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i");
895
896
                    // ----- Read next block
897
                    $v_buffer = gzread($p_tar, 512);
898
                } while (!gzeof($p_tar));
899
900
                TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks");
901
            }
902
        } // ----- Look for uncompressed tar file
903
        else {
904
            if ('tar' === $p_mode) {
905
                // ----- Open the tar file
@@ 1252-1271 (lines=20) @@
1249
            $v_buffer = gzread($p_tar, 512);
1250
1251
            // ----- Read the following blocks but not the last one
1252
            if (!gzeof($p_tar)) {
1253
                TrFctMessage(__FILE__, __LINE__, 3, 'More than one 512 block file');
1254
                $i = 1;
1255
1256
                // ----- Read new 512 block and write the already read
1257
                do {
1258
                    // ----- Write the already read block
1259
                    $v_binary_data = pack('a512', "$v_buffer");
1260
                    gzputs($v_temp_tar, $v_binary_data);
1261
1262
                    ++$i;
1263
                    TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i");
1264
1265
                    // ----- Read next block
1266
                    $v_buffer = gzread($p_tar, 512);
1267
                } while (!gzeof($p_tar));
1268
1269
                TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks");
1270
            }
1271
1272
            // ----- Call the adding fct inside the tar
1273
            if (1 == ($v_result = PclTarHandleAddList($v_temp_tar, $p_list, $p_mode, $p_list_detail, $p_add_dir, $p_remove_dir))) {
1274
                // ----- Call the footer of the tar archive