|
@@ 2757-2814 (lines=58) @@
|
| 2754 |
|
$v_nb = 0; |
| 2755 |
|
|
| 2756 |
|
// ----- Look for regular tar file |
| 2757 |
|
if ('tar' === $p_tar_mode) { |
| 2758 |
|
// ----- Open file |
| 2759 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in binary read mode'); |
| 2760 |
|
if (0 == ($v_tar = @fopen($p_tarname, 'rb'))) { |
| 2761 |
|
// ----- Error log |
| 2762 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 2763 |
|
|
| 2764 |
|
// ----- Return |
| 2765 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2766 |
|
|
| 2767 |
|
return PclErrorCode(); |
| 2768 |
|
} |
| 2769 |
|
|
| 2770 |
|
// ----- Open a temporary file in write mode |
| 2771 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 2772 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 2773 |
|
if (0 == ($v_temp_tar = @fopen($v_temp_tarname, 'wb'))) { |
| 2774 |
|
// ----- Close tar file |
| 2775 |
|
fclose($v_tar); |
| 2776 |
|
|
| 2777 |
|
// ----- Error log |
| 2778 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 2779 |
|
|
| 2780 |
|
// ----- Return |
| 2781 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2782 |
|
|
| 2783 |
|
return PclErrorCode(); |
| 2784 |
|
} |
| 2785 |
|
} // ----- Look for compressed tar file |
| 2786 |
|
else { |
| 2787 |
|
// ----- Open the file in read mode |
| 2788 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in gzip binary read mode'); |
| 2789 |
|
if (0 == ($v_tar = @gzopen($p_tarname, 'rb'))) { |
| 2790 |
|
// ----- Error log |
| 2791 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 2792 |
|
|
| 2793 |
|
// ----- Return |
| 2794 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2795 |
|
|
| 2796 |
|
return PclErrorCode(); |
| 2797 |
|
} |
| 2798 |
|
|
| 2799 |
|
// ----- Open a temporary file in write mode |
| 2800 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 2801 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 2802 |
|
if (0 == ($v_temp_tar = @gzopen($v_temp_tarname, 'wb'))) { |
| 2803 |
|
// ----- Close tar file |
| 2804 |
|
gzclose($v_tar); |
| 2805 |
|
|
| 2806 |
|
// ----- Error log |
| 2807 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 2808 |
|
|
| 2809 |
|
// ----- Return |
| 2810 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2811 |
|
|
| 2812 |
|
return PclErrorCode(); |
| 2813 |
|
} |
| 2814 |
|
} |
| 2815 |
|
|
| 2816 |
|
// ----- Read the blocks |
| 2817 |
|
while (!($v_end_of_file = ('tar' === $p_tar_mode ? feof($v_tar) : gzeof($v_tar)))) { |
|
@@ 2995-3052 (lines=58) @@
|
| 2992 |
|
$v_found_list = []; |
| 2993 |
|
|
| 2994 |
|
// ----- Look for regular tar file |
| 2995 |
|
if ('tar' === $p_tar_mode) { |
| 2996 |
|
// ----- Open file |
| 2997 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in binary read mode'); |
| 2998 |
|
if (0 == ($v_tar = @fopen($p_tarname, 'rb'))) { |
| 2999 |
|
// ----- Error log |
| 3000 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 3001 |
|
|
| 3002 |
|
// ----- Return |
| 3003 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3004 |
|
|
| 3005 |
|
return PclErrorCode(); |
| 3006 |
|
} |
| 3007 |
|
|
| 3008 |
|
// ----- Open a temporary file in write mode |
| 3009 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 3010 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 3011 |
|
if (0 == ($v_temp_tar = @fopen($v_temp_tarname, 'wb'))) { |
| 3012 |
|
// ----- Close tar file |
| 3013 |
|
fclose($v_tar); |
| 3014 |
|
|
| 3015 |
|
// ----- Error log |
| 3016 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 3017 |
|
|
| 3018 |
|
// ----- Return |
| 3019 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3020 |
|
|
| 3021 |
|
return PclErrorCode(); |
| 3022 |
|
} |
| 3023 |
|
} // ----- Look for compressed tar file |
| 3024 |
|
else { |
| 3025 |
|
// ----- Open the file in read mode |
| 3026 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in gzip binary read mode'); |
| 3027 |
|
if (0 == ($v_tar = @gzopen($p_tarname, 'rb'))) { |
| 3028 |
|
// ----- Error log |
| 3029 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 3030 |
|
|
| 3031 |
|
// ----- Return |
| 3032 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3033 |
|
|
| 3034 |
|
return PclErrorCode(); |
| 3035 |
|
} |
| 3036 |
|
|
| 3037 |
|
// ----- Open a temporary file in write mode |
| 3038 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 3039 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 3040 |
|
if (0 == ($v_temp_tar = @gzopen($v_temp_tarname, 'wb'))) { |
| 3041 |
|
// ----- Close tar file |
| 3042 |
|
gzclose($v_tar); |
| 3043 |
|
|
| 3044 |
|
// ----- Error log |
| 3045 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 3046 |
|
|
| 3047 |
|
// ----- Return |
| 3048 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3049 |
|
|
| 3050 |
|
return PclErrorCode(); |
| 3051 |
|
} |
| 3052 |
|
} |
| 3053 |
|
|
| 3054 |
|
// ----- Prepare the list of files |
| 3055 |
|
for ($i = 0, $iMax = count($p_file_list); $i < $iMax; ++$i) { |