|
@@ 2780-2837 (lines=58) @@
|
| 2777 |
|
$v_nb = 0; |
| 2778 |
|
|
| 2779 |
|
// ----- Look for regular tar file |
| 2780 |
|
if ($p_tar_mode === 'tar') { |
| 2781 |
|
// ----- Open file |
| 2782 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in binary read mode'); |
| 2783 |
|
if (($v_tar = @fopen($p_tarname, 'rb')) == 0) { |
| 2784 |
|
// ----- Error log |
| 2785 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 2786 |
|
|
| 2787 |
|
// ----- Return |
| 2788 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2789 |
|
|
| 2790 |
|
return PclErrorCode(); |
| 2791 |
|
} |
| 2792 |
|
|
| 2793 |
|
// ----- Open a temporary file in write mode |
| 2794 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 2795 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 2796 |
|
if (($v_temp_tar = @fopen($v_temp_tarname, 'wb')) == 0) { |
| 2797 |
|
// ----- Close tar file |
| 2798 |
|
fclose($v_tar); |
| 2799 |
|
|
| 2800 |
|
// ----- Error log |
| 2801 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 2802 |
|
|
| 2803 |
|
// ----- Return |
| 2804 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2805 |
|
|
| 2806 |
|
return PclErrorCode(); |
| 2807 |
|
} |
| 2808 |
|
} // ----- Look for compressed tar file |
| 2809 |
|
else { |
| 2810 |
|
// ----- Open the file in read mode |
| 2811 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in gzip binary read mode'); |
| 2812 |
|
if (($v_tar = @gzopen($p_tarname, 'rb')) == 0) { |
| 2813 |
|
// ----- Error log |
| 2814 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 2815 |
|
|
| 2816 |
|
// ----- Return |
| 2817 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2818 |
|
|
| 2819 |
|
return PclErrorCode(); |
| 2820 |
|
} |
| 2821 |
|
|
| 2822 |
|
// ----- Open a temporary file in write mode |
| 2823 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 2824 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 2825 |
|
if (($v_temp_tar = @gzopen($v_temp_tarname, 'wb')) == 0) { |
| 2826 |
|
// ----- Close tar file |
| 2827 |
|
gzclose($v_tar); |
| 2828 |
|
|
| 2829 |
|
// ----- Error log |
| 2830 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 2831 |
|
|
| 2832 |
|
// ----- Return |
| 2833 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 2834 |
|
|
| 2835 |
|
return PclErrorCode(); |
| 2836 |
|
} |
| 2837 |
|
} |
| 2838 |
|
|
| 2839 |
|
// ----- Read the blocks |
| 2840 |
|
while (!($v_end_of_file = ($p_tar_mode === 'tar' ? feof($v_tar) : gzeof($v_tar)))) { |
|
@@ 3018-3075 (lines=58) @@
|
| 3015 |
|
$v_found_list = array(); |
| 3016 |
|
|
| 3017 |
|
// ----- Look for regular tar file |
| 3018 |
|
if ($p_tar_mode === 'tar') { |
| 3019 |
|
// ----- Open file |
| 3020 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in binary read mode'); |
| 3021 |
|
if (($v_tar = @fopen($p_tarname, 'rb')) == 0) { |
| 3022 |
|
// ----- Error log |
| 3023 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 3024 |
|
|
| 3025 |
|
// ----- Return |
| 3026 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3027 |
|
|
| 3028 |
|
return PclErrorCode(); |
| 3029 |
|
} |
| 3030 |
|
|
| 3031 |
|
// ----- Open a temporary file in write mode |
| 3032 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 3033 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 3034 |
|
if (($v_temp_tar = @fopen($v_temp_tarname, 'wb')) == 0) { |
| 3035 |
|
// ----- Close tar file |
| 3036 |
|
fclose($v_tar); |
| 3037 |
|
|
| 3038 |
|
// ----- Error log |
| 3039 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 3040 |
|
|
| 3041 |
|
// ----- Return |
| 3042 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3043 |
|
|
| 3044 |
|
return PclErrorCode(); |
| 3045 |
|
} |
| 3046 |
|
} // ----- Look for compressed tar file |
| 3047 |
|
else { |
| 3048 |
|
// ----- Open the file in read mode |
| 3049 |
|
TrFctMessage(__FILE__, __LINE__, 3, 'Open file in gzip binary read mode'); |
| 3050 |
|
if (($v_tar = @gzopen($p_tarname, 'rb')) == 0) { |
| 3051 |
|
// ----- Error log |
| 3052 |
|
PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); |
| 3053 |
|
|
| 3054 |
|
// ----- Return |
| 3055 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3056 |
|
|
| 3057 |
|
return PclErrorCode(); |
| 3058 |
|
} |
| 3059 |
|
|
| 3060 |
|
// ----- Open a temporary file in write mode |
| 3061 |
|
$v_temp_tarname = uniqid('pcltar-', true) . '.tmp'; |
| 3062 |
|
TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); |
| 3063 |
|
if (($v_temp_tar = @gzopen($v_temp_tarname, 'wb')) == 0) { |
| 3064 |
|
// ----- Close tar file |
| 3065 |
|
gzclose($v_tar); |
| 3066 |
|
|
| 3067 |
|
// ----- Error log |
| 3068 |
|
PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); |
| 3069 |
|
|
| 3070 |
|
// ----- Return |
| 3071 |
|
TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); |
| 3072 |
|
|
| 3073 |
|
return PclErrorCode(); |
| 3074 |
|
} |
| 3075 |
|
} |
| 3076 |
|
|
| 3077 |
|
// ----- Prepare the list of files |
| 3078 |
|
for ($i = 0, $iMax = count($p_file_list); $i < $iMax; ++$i) { |