![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/Archive/Helper/File/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** * Helper class that simplifies gz files stream reading and writing */ namespace Magento\Framework\Archive\Helper\File; class Gz extends \Magento\Framework\Archive\Helper\File { /** * {@inheritdoc} * @throws \RuntimeException */ protected function _open($mode) { if (!extension_loaded('zlib')) { throw new \RuntimeException('PHP extension zlib is required.'); } $this->_fileHandler = gzopen($this->_filePath, $mode); if (false === $this->_fileHandler) { throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase('The "%1" file failed to open.', [$this->_filePath]) ); } } /** * {@inheritdoc} */ protected function _write($data) { $result = gzwrite($this->_fileHandler, $data); if (empty($result) && !empty($data)) { throw new \Magento\Framework\Exception\LocalizedException( new \Magento\Framework\Phrase('The data failed to write to "%1".', [$this->_filePath]) ); } } /** * {@inheritdoc} */ protected function _read($length) { return gzread($this->_fileHandler, $length); } /** * {@inheritdoc} */ protected function _eof() { return gzeof($this->_fileHandler); } /** * {@inheritdoc} */ protected function _close() { gzclose($this->_fileHandler); } }