@@ -89,8 +89,6 @@ public function __construct()
89
89
define ('PCLZIP_TEMPORARY_DIR ' , sys_get_temp_dir () . '/ ' );
90
90
}
91
91
require_once 'PCLZip/pclzip.lib.php ' ;
92
- } else {
93
- $ this ->zip = new \ZipArchive ();
94
92
}
95
93
}
96
94
@@ -120,6 +118,31 @@ public function __call($function, $args)
120
118
return $ result ;
121
119
}
122
120
121
+ /**
122
+ * Open a new zip archive
123
+ *
124
+ * @param string $filename The file name of the ZIP archive to open
125
+ * @param int $flags The mode to use to open the archive
126
+ * @return bool
127
+ */
128
+ public function open ($ filename , $ flags = null )
129
+ {
130
+ $ result = true ;
131
+ $ this ->filename = $ filename ;
132
+
133
+ if (!$ this ->usePclzip ) {
134
+ $ this ->zip = new \ZipArchive ();
135
+ $ result = $ this ->zip ->open ($ this ->filename , $ flags );
136
+ $ this ->numFiles = $ this ->zip ->numFiles ;
137
+ } else {
138
+ $ this ->zip = new \PclZip ($ this ->filename );
139
+ $ this ->tempDir = sys_get_temp_dir ();
140
+ $ this ->numFiles = count ($ this ->zip ->listContent ());
141
+ }
142
+
143
+ return $ result ;
144
+ }
145
+
123
146
/**
124
147
* Close the active archive
125
148
*
@@ -158,30 +181,6 @@ public function extractTo($destination, $entries = null)
158
181
}
159
182
}
160
183
161
- /**
162
- * Open a new zip archive
163
- *
164
- * @param string $filename The file name of the ZIP archive to open
165
- * @param int $flags The mode to use to open the archive
166
- * @return bool
167
- */
168
- public function open ($ filename , $ flags = null )
169
- {
170
- $ result = true ;
171
- $ this ->filename = $ filename ;
172
-
173
- if (!$ this ->usePclzip ) {
174
- $ result = $ this ->zip ->open ($ this ->filename , $ flags );
175
- $ this ->numFiles = $ this ->zip ->numFiles ;
176
- } else {
177
- $ this ->tempDir = sys_get_temp_dir ();
178
- $ this ->zip = new \PclZip ($ this ->filename );
179
- $ this ->numFiles = count ($ this ->zip ->listContent ());
180
- }
181
-
182
- return $ result ;
183
- }
184
-
185
184
/**
186
185
* Extract file from archive by given file name (emulate \ZipArchive)
187
186
*
0 commit comments