diff --git a/build/stubs/zip.php b/build/stubs/zip.php new file mode 100644 index 0000000000000..10590aeed50e4 --- /dev/null +++ b/build/stubs/zip.php @@ -0,0 +1,1482 @@ + + * Open a ZIP file archive + * + * @link https://php.net/manual/en/ziparchive.open.php + * + * @param string $filename

+ * The file name of the ZIP archive to open. + *

+ * @param int $flags [optional]

+ * The mode to use to open the archive. + *

+ *

+ * ZipArchive::OVERWRITE + *

+ * + * @return mixed Error codes + *

+ * Returns TRUE on success or the error code. + *

+ *

+ * ZipArchive::ER_EXISTS + *

+ *

+ * File already exists. + *

+ *

+ * ZipArchive::ER_INCONS + *

+ *

+ * Zip archive inconsistent. + *

+ *

+ * ZipArchive::ER_INVAL + *

+ *

+ * Invalid argument. + *

+ *

+ * ZipArchive::ER_MEMORY + *

+ *

+ * Malloc failure. + *

+ *

+ * ZipArchive::ER_NOENT + *

+ *

+ * No such file. + *

+ *

+ * ZipArchive::ER_NOZIP + *

+ *

+ * Not a zip archive. + *

+ *

+ * ZipArchive::ER_OPEN + *

+ *

+ * Can't open file. + *

+ *

+ * ZipArchive::ER_READ + *

+ *

+ * Read error. + *

+ *

+ * ZipArchive::ER_SEEK + *

+ *

+ * Seek error. + *

+ */ + public function open( + $filename, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Close the active archive (opened or newly created) + * @link https://php.net/manual/en/ziparchive.close.php + * @return bool TRUE on success or FALSE on failure. + */ + public function close() {} + + /** + * (PHP 7 >= 7.2.0, PECL zip >= 1.15.0)
+ * Counts the number of files in the archive. + * @link https://www.php.net/manual/en/ziparchive.count.php + * @return int + * @since 7.2 + */ + public function count() {} + + /** + * Returns the status error message, system and/or zip messages + * @link https://php.net/manual/en/ziparchive.getstatusstring.php + * @return string|false a string with the status message on success or FALSE on failure. + * @since 5.2.7 + */ + public function getStatusString() {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.8.0)
+ * Add a new directory + * @link https://php.net/manual/en/ziparchive.addemptydir.php + * @param string $dirname

+ * The directory to add. + *

+ * @param int $flags [optional] Set how to manage name encoding (ZipArchive::FL_ENC_*) and entry replacement (ZipArchive::FL_OVERWRITE) + * @return bool TRUE on success or FALSE on failure. + */ + public function addEmptyDir( + string $dirname, + int $flags = 0 + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Add a file to a ZIP archive using its contents + * @link https://php.net/manual/en/ziparchive.addfromstring.php + * @param string $name

+ * The name of the entry to create. + *

+ * @param string $content

+ * The contents to use to create the entry. It is used in a binary + * safe mode. + *

+ * @param int $flags [optional] Set how to manage name encoding (ZipArchive::FL_ENC_*) and entry replacement (ZipArchive::FL_OVERWRITE) + * @return bool TRUE on success or FALSE on failure. + */ + public function addFromString( + $name, + $content, + $flags = 8192 + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Adds a file to a ZIP archive from the given path + * @link https://php.net/manual/en/ziparchive.addfile.php + * @param string $filepath

+ * The path to the file to add. + *

+ * @param string $entryname [optional]

+ * If supplied, this is the local name inside the ZIP archive that will override the filename. + *

+ * @param int $start [optional]

+ * This parameter is not used but is required to extend ZipArchive. + *

+ * @param int $length [optional]

+ * This parameter is not used but is required to extend ZipArchive. + *

+ * @param int $flags [optional] Set how to manage name encoding (ZipArchive::FL_ENC_*) and entry replacement (ZipArchive::FL_OVERWRITE) + * @return bool TRUE on success or FALSE on failure. + */ + public function addFile( + $filepath, + $entryname = null, + $start = 0, + $length = 0, + $flags = 8192 + ) {} + + /** + * (PHP 5 >= 5.3.0, PECL zip >= 1.9.0)
+ * Add files from a directory by glob pattern + * @link https://php.net/manual/en/ziparchive.addglob.php + * @param string $pattern

+ * A glob pattern against which files will be matched. + *

+ * @param int $flags [optional]

+ * A bit mask of glob() flags. + *

+ * @param array $options [optional]

+ * An associative array of options. Available options are: + *

+ *

+ * "add_path" + *

+ *

+ * Prefix to prepend when translating to the local path of the file within + * the archive. This is applied after any remove operations defined by the + * "remove_path" or "remove_all_path" + * options. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function addGlob( + $pattern, + $flags = 0, + array $options = [] + ) {} + + /** + * (PHP 5 >= 5.3.0, PECL zip >= 1.9.0)
+ * Add files from a directory by PCRE pattern + * @link https://php.net/manual/en/ziparchive.addpattern.php + * @param string $pattern

+ * A PCRE pattern against which files will be matched. + *

+ * @param string $path [optional]

+ * The directory that will be scanned. Defaults to the current working directory. + *

+ * @param array $options [optional]

+ * An associative array of options accepted by ZipArchive::addGlob. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function addPattern( + $pattern, + $path = '.', + array $options = [] + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * Renames an entry defined by its index + * @link https://php.net/manual/en/ziparchive.renameindex.php + * @param int $index

+ * Index of the entry to rename. + *

+ * @param string $new_name

+ * New name. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function renameIndex( + $index, + $new_name + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * Renames an entry defined by its name + * @link https://php.net/manual/en/ziparchive.renamename.php + * @param string $name

+ * Name of the entry to rename. + *

+ * @param string $new_name

+ * New name. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function renameName( + $name, + $new_name + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
+ * Set the comment of a ZIP archive + * @link https://php.net/manual/en/ziparchive.setarchivecomment.php + * @param string $comment

+ * The contents of the comment. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function setArchiveComment( $comment) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Returns the Zip archive comment + * @link https://php.net/manual/en/ziparchive.getarchivecomment.php + * @param int $flags [optional]

+ * If flags is set to ZipArchive::FL_UNCHANGED, the original unchanged + * comment is returned. + *

+ * @return string|false the Zip archive comment or FALSE on failure. + */ + public function getArchiveComment( $flags = null) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
+ * Set the comment of an entry defined by its index + * @link https://php.net/manual/en/ziparchive.setcommentindex.php + * @param int $index

+ * Index of the entry. + *

+ * @param string $comment

+ * The contents of the comment. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function setCommentIndex( + $index, + $comment + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
+ * Set the comment of an entry defined by its name + * @link https://php.net/manual/en/ziparchive.setcommentname.php + * @param string $name

+ * Name of the entry. + *

+ * @param string $comment

+ * The contents of the comment. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function setCommentName( + $name, + $comment + ) {} + + /** + * Set the compression method of an entry defined by its index + * @link https://php.net/manual/en/ziparchive.setcompressionindex.php + * @param int $index Index of the entry. + * @param int $method The compression method. Either ZipArchive::CM_DEFAULT, ZipArchive::CM_STORE or ZipArchive::CM_DEFLATE. + * @param int $compflags [optional] Compression flags. Currently unused. + * @return bool Returns TRUE on success or FALSE on failure. + * @since 7.0 + */ + public function setCompressionIndex(int $index, int $method, int $compflags = 0) {} + + /** + * Set the compression method of an entry defined by its name + * https://secure.php.net/manual/en/ziparchive.setcompressionname.php + * @param string $name Name of the entry. + * @param int $method The compression method. Either ZipArchive::CM_DEFAULT, ZipArchive::CM_STORE or ZipArchive::CM_DEFLATE. + * @param int $compflags [optional] Compression flags. Currently unused. + * @return bool Returns TRUE on success or FALSE on failure. + * @since 7.0 + */ + public function setCompressionName(string $name, int $method, int $compflags = 0) {} + + /** + * Set the encryption method of an entry defined by its index + * @link https://php.net/manual/en/ziparchive.setencryptionindex.php + * @param int $index Index of the entry. + * @param int $method The encryption method defined by one of the ZipArchive::EM_ constants. + * @param string|null $password [optional] Optional password, default used when missing. + * @return bool Returns TRUE on success or FALSE on failure. + * @since 7.2 + */ + public function setEncryptionIndex(int $index, int $method, ?string $password = null) {} + + /** + * Set the encryption method of an entry defined by its name + * @link https://php.net/manual/en/ziparchive.setencryptionname.php + * @param string $name Name of the entry. + * @param int $method The encryption method defined by one of the ZipArchive::EM_ constants. + * @param string|null $password [optional] Optional password, default used when missing. + * @return bool Returns TRUE on success or FALSE on failure. + * @since 7.2 + */ + public function setEncryptionName(string $name, int $method, ?string $password = null) {} + + /** + * (PHP 5 >= 5.6.0, PECL zip >= 1.12.0)
+ * @param string $password + * @return bool + */ + public function setPassword( $password) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
+ * Returns the comment of an entry using the entry index + * @link https://php.net/manual/en/ziparchive.getcommentindex.php + * @param int $index

+ * Index of the entry + *

+ * @param int $flags [optional]

+ * If flags is set to ZipArchive::FL_UNCHANGED, the original unchanged + * comment is returned. + *

+ * @return string|false the comment on success or FALSE on failure. + */ + public function getCommentIndex( + $index, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.4.0)
+ * Returns the comment of an entry using the entry name + * @link https://php.net/manual/en/ziparchive.getcommentname.php + * @param string $name

+ * Name of the entry + *

+ * @param int $flags [optional]

+ * If flags is set to ZipArchive::FL_UNCHANGED, the original unchanged + * comment is returned. + *

+ * @return string|false the comment on success or FALSE on failure. + */ + public function getCommentName( + $name, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * delete an entry in the archive using its index + * @link https://php.net/manual/en/ziparchive.deleteindex.php + * @param int $index

+ * Index of the entry to delete. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function deleteIndex( $index) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * delete an entry in the archive using its name + * @link https://php.net/manual/en/ziparchive.deletename.php + * @param string $name

+ * Name of the entry to delete. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function deleteName( $name) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * Get the details of an entry defined by its name. + * @link https://php.net/manual/en/ziparchive.statname.php + * @param string $name

+ * Name of the entry + *

+ * @param int $flags [optional]

+ * The flags argument specifies how the name lookup should be done. + * Also, ZipArchive::FL_UNCHANGED may be ORed to it to request + * information about the original file in the archive, + * ignoring any changes made. + * ZipArchive::FL_NOCASE + *

+ * @return array|false an array containing the entry details or FALSE on failure. + */ + public function statName( + $name, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Get the details of an entry defined by its index. + * @link https://php.net/manual/en/ziparchive.statindex.php + * @param int $index

+ * Index of the entry + *

+ * @param int $flags [optional]

+ * ZipArchive::FL_UNCHANGED may be ORed to it to request + * information about the original file in the archive, + * ignoring any changes made. + *

+ * @return array|false an array containing the entry details or FALSE on failure. + */ + public function statIndex( + $index, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * Returns the index of the entry in the archive + * @link https://php.net/manual/en/ziparchive.locatename.php + * @param string $name

+ * The name of the entry to look up + *

+ * @param int $flags [optional]

+ * The flags are specified by ORing the following values, + * or 0 for none of them. + * ZipArchive::FL_NOCASE + *

+ * @return int|false the index of the entry on success or FALSE on failure. + */ + public function locateName( + $name, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * Returns the name of an entry using its index + * @link https://php.net/manual/en/ziparchive.getnameindex.php + * @param int $index

+ * Index of the entry. + *

+ * @param int $flags [optional]

+ * If flags is set to ZipArchive::FL_UNCHANGED, the original unchanged + * name is returned. + *

+ * @return string|false the name on success or FALSE on failure. + */ + public function getNameIndex( + $index, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Revert all global changes done in the archive. + * @link https://php.net/manual/en/ziparchive.unchangearchive.php + * @return bool TRUE on success or FALSE on failure. + */ + public function unchangeArchive() {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Undo all changes done in the archive + * @link https://php.net/manual/en/ziparchive.unchangeall.php + * @return bool TRUE on success or FALSE on failure. + */ + public function unchangeAll() {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Revert all changes done to an entry at the given index + * @link https://php.net/manual/en/ziparchive.unchangeindex.php + * @param int $index

+ * Index of the entry. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function unchangeIndex( $index) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.5.0)
+ * Revert all changes done to an entry with the given name. + * @link https://php.net/manual/en/ziparchive.unchangename.php + * @param string $name

+ * Name of the entry. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function unchangeName( $name) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Extract the archive contents + * @link https://php.net/manual/en/ziparchive.extractto.php + * @param string $pathto

+ * Location where to extract the files. + *

+ * @param mixed $files [optional]

+ * The entries to extract. It accepts either a single entry name or + * an array of names. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function extractTo( + $pathto, + $files = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Returns the entry contents using its name + * @link https://php.net/manual/en/ziparchive.getfromname.php + * @param string $name

+ * Name of the entry + *

+ * @param int $len [optional]

+ * The length to be read from the entry. If 0, then the + * entire entry is read. + *

+ * @param int $flags [optional]

+ * The flags to use to open the archive. the following values may + * be ORed to it. + * ZipArchive::FL_UNCHANGED + *

+ * @return string|false the contents of the entry on success or FALSE on failure. + */ + public function getFromName( + $name, + $len = 0, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.3.0)
+ * Returns the entry contents using its index + * @link https://php.net/manual/en/ziparchive.getfromindex.php + * @param int $index

+ * Index of the entry + *

+ * @param int $len [optional]

+ * The length to be read from the entry. If 0, then the + * entire entry is read. + *

+ * @param int $flags [optional]

+ * The flags to use to open the archive. the following values may + * be ORed to it. + *

+ *

+ * ZipArchive::FL_UNCHANGED + *

+ * @return string|false the contents of the entry on success or FALSE on failure. + */ + public function getFromIndex( + $index, + $len = 0, + $flags = null + ) {} + + /** + * (PHP 5 >= 5.2.0, PECL zip >= 1.1.0)
+ * Get a file handler to the entry defined by its name (read only). + * @link https://php.net/manual/en/ziparchive.getstream.php + * @param string $name

+ * The name of the entry to use. + *

+ * @return resource|false a file pointer (resource) on success or FALSE on failure. + */ + public function getStream( $name) {} + + /** + * Set the external attributes of an entry defined by its name + * @link https://www.php.net/manual/en/ziparchive.setexternalattributesname.php + * @param string $name Name of the entry + * @param int $opsys The operating system code defined by one of the ZipArchive::OPSYS_ constants. + * @param int $attr The external attributes. Value depends on operating system. + * @param int $flags [optional] Optional flags. Currently unused. + * @return bool Returns TRUE on success or FALSE on failure. + */ + public function setExternalAttributesName( + $name, + $opsys, + $attr, + $flags = null + ) {} + + /** + * Retrieve the external attributes of an entry defined by its name + * @link https://www.php.net/manual/en/ziparchive.getexternalattributesname.php + * @param string $name Name of the entry + * @param int &$opsys On success, receive the operating system code defined by one of the ZipArchive::OPSYS_ constants. + * @param int &$attr On success, receive the external attributes. Value depends on operating system. + * @param int $flags [optional] If flags is set to ZipArchive::FL_UNCHANGED, the original unchanged attributes are returned. + * @return bool Returns TRUE on success or FALSE on failure. + */ + public function getExternalAttributesName( + $name, + &$opsys, + &$attr, + $flags = null + ) {} + + /** + * Set the external attributes of an entry defined by its index + * @link https://www.php.net/manual/en/ziparchive.setexternalattributesindex.php + * @param int $index Index of the entry. + * @param int $opsys The operating system code defined by one of the ZipArchive::OPSYS_ constants. + * @param int $attr The external attributes. Value depends on operating system. + * @param int $flags [optional] Optional flags. Currently unused. + * @return bool Returns TRUE on success or FALSE on failure. + */ + public function setExternalAttributesIndex( + $index, + $opsys, + $attr, + $flags = null + ) {} + + /** + * Retrieve the external attributes of an entry defined by its index + * @link https://www.php.net/manual/en/ziparchive.getexternalattributesindex.php + * @param int $index Index of the entry. + * @param int &$opsys On success, receive the operating system code defined by one of the ZipArchive::OPSYS_ constants. + * @param int &$attr On success, receive the external attributes. Value depends on operating system. + * @param int $flags [optional] If flags is set to ZipArchive::FL_UNCHANGED, the original unchanged attributes are returned. + * @return bool Returns TRUE on success or FALSE on failure. + */ + public function getExternalAttributesIndex( + $index, + &$opsys, + &$attr, + $flags = null + ) {} + + public static function isEncryptionMethodSupported( + $method, + $enc = true + ) {} + + public static function isCompressionMethodSupported( + $method, + $enc = true + ) {} + + public function registerCancelCallback( $callback) {} + + public function registerProgressCallback( + $rate, + $callback + ) {} + + public function setMtimeName( + $name, + $timestamp, + $flags = null + ) {} + + public function setMtimeIndex( + $index, + $timestamp, + $flags = null + ) {} + + public function replaceFile( + $filepath, + $index, + $start = null, + $length = null, + $flags = null + ) {} +} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Open a ZIP file archive + * @link https://php.net/manual/en/function.zip-open.php + * @param string $filename

+ * The file name of the ZIP archive to open. + *

+ * @return resource|int|false a resource handle for later use with + * zip_read and zip_close + * or returns the number of error if filename does not + * exist or in case of other error. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_open(string $filename) {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Close a ZIP file archive + * @link https://php.net/manual/en/function.zip-close.php + * @param resource $zip

+ * A ZIP file previously opened with zip_open. + *

+ * @return void No value is returned. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_close($zip): void {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Read next entry in a ZIP file archive + * @link https://php.net/manual/en/function.zip-read.php + * @param resource $zip

+ * A ZIP file previously opened with zip_open. + *

+ * @return resource|false a directory entry resource for later use with the + * zip_entry_... functions, or FALSE if + * there are no more entries to read, or an error code if an error + * occurred. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_read($zip) {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Open a directory entry for reading + * @link https://php.net/manual/en/function.zip-entry-open.php + * @param resource $zip_dp

+ * A valid resource handle returned by zip_open. + *

+ * @param resource $zip_entry

+ * A directory entry returned by zip_read. + *

+ * @param string $mode [optional]

+ * Any of the modes specified in the documentation of + * fopen. + *

+ *

+ * Currently, mode is ignored and is always + * "rb". This is due to the fact that zip support + * in PHP is read only access. + *

+ * @return bool TRUE on success or FALSE on failure. + *

+ * Unlike fopen and other similar functions, + * the return value of zip_entry_open only + * indicates the result of the operation and is not needed for + * reading or closing the directory entry. + *

+ */ +function zip_entry_open($zip_dp, $zip_entry, string $mode = 'rb'): bool {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Close a directory entry + * @link https://php.net/manual/en/function.zip-entry-close.php + * @param resource $zip_entry

+ * A directory entry previously opened zip_entry_open. + *

+ * @return bool TRUE on success or FALSE on failure. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_entry_close($zip_entry): bool {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Read from an open directory entry + * @link https://php.net/manual/en/function.zip-entry-read.php + * @param resource $zip_entry

+ * A directory entry returned by zip_read. + *

+ * @param int $len [optional]

+ * The number of bytes to return. + *

+ *

+ * This should be the uncompressed length you wish to read. + *

+ * @return string|false the data read, empty string on end of a file, or FALSE on error. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_entry_read($zip_entry, int $len = 1024): string|false {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Retrieve the actual file size of a directory entry + * @link https://php.net/manual/en/function.zip-entry-filesize.php + * @param resource $zip_entry

+ * A directory entry returned by zip_read. + *

+ * @return int|false The size of the directory entry. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_entry_filesize($zip_entry): int|false {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Retrieve the name of a directory entry + * @link https://php.net/manual/en/function.zip-entry-name.php + * @param resource $zip_entry

+ * A directory entry returned by zip_read. + *

+ * @return string|false The name of the directory entry. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_entry_name($zip_entry): string|false {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Retrieve the compressed size of a directory entry + * @link https://php.net/manual/en/function.zip-entry-compressedsize.php + * @param resource $zip_entry

+ * A directory entry returned by zip_read. + *

+ * @return int|false The compressed size. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_entry_compressedsize($zip_entry): int|false {} + +/** + * (PHP 4 >= 4.1.0, PHP 5 >= 5.2.0, PECL zip >= 1.0.0)
+ * Retrieve the compression method of a directory entry + * @link https://php.net/manual/en/function.zip-entry-compressionmethod.php + * @param resource $zip_entry

+ * A directory entry returned by zip_read. + *

+ * @return string|false The compression method. + * @deprecated 8.0 Use {@link ZipArchive} instead. + */ +function zip_entry_compressionmethod($zip_entry): string|false {} + +// End of zip v.1.11.0 diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php index ca9a046ab832f..743d313f951b0 100644 --- a/lib/private/Archive/ZIP.php +++ b/lib/private/Archive/ZIP.php @@ -110,6 +110,9 @@ public function mtime(string $path) { * get the files in a folder */ public function getFolder(string $path): array { + // FIXME: multiple calls on getFolder would traverse + // the whole file list over and over again + // maybe use a Generator or cache the list ? $files = $this->getFiles(); $folderContent = []; $pathLength = strlen($path); @@ -123,6 +126,32 @@ public function getFolder(string $path): array { return $folderContent; } + /** + * Generator that returns metadata of all files + * + * @return \Generator + */ + public function getAllFilesStat() { + $fileCount = $this->zip->numFiles; + for ($i = 0;$i < $fileCount;$i++) { + yield $this->zip->statIndex($i); + } + } + + /** + * Return stat information for the given path + * + * @param string path path to get stat information on + * @return ?array stat information or null if not found + */ + public function getStat(string $path): ?array { + $stat = $this->zip->statName($path); + if (!$stat) { + return null; + } + return $stat; + } + /** * get all files in the archive */ diff --git a/psalm.xml b/psalm.xml index 9b3ea0444359f..d9fad733c2517 100644 --- a/psalm.xml +++ b/psalm.xml @@ -77,6 +77,7 @@ +