• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP gzeof函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中gzeof函数的典型用法代码示例。如果您正苦于以下问题:PHP gzeof函数的具体用法?PHP gzeof怎么用?PHP gzeof使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了gzeof函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getAll

 public function getAll()
 {
     $buffer = "";
     $counter = 0;
     $sum = 0;
     $total = 0;
     $last = microtime(true);
     $bwlimit = $this->getBwlimit();
     while (!gzeof($this->datasource)) {
         $tmp = $this->read();
         $bytes = strlen($tmp);
         $buffer .= $tmp;
         $sum += $bytes;
         $total += $bytes;
         $counter++;
         if ($bwlimit > 0 && $sum > $bwlimit) {
             $current = microtime(true);
             $wait = $current - $last;
             if ($wait < 1) {
                 $wait = 1 - $wait;
                 usleep($wait * 1000000);
             }
             $sum = 0;
             $last = microtime(true);
         }
     }
     return $buffer;
 }
开发者ID:chobie,项目名称:treasuredata-api-client,代码行数:28,代码来源:GzipInputStream.php


示例2: extractTar

 public function extractTar($src, $dest)
 {
     if ($this->is_tar($src)) {
         file_put_contents($tmp = '~tmp(' . microtime() . ').tar', $src);
         $src = $tmp;
     }
     $ptr = gzopen($src, 'r');
     while (!gzeof($ptr)) {
         $infos = $this->readTarHeader($ptr);
         if ($infos['type'] == '5') {
             if (!file_exists($dest . $infos['name'])) {
                 mkdir($dest . $infos['name'], 0777, true);
             }
             $result[] = $dest . $infos['name'];
         } elseif ($infos['type'] == '0' || $infos['type'] == chr(0)) {
             $dirPath = substr($infos['name'], 0, strrpos($infos['name'], '/'));
             if (!file_exists($dest . $dirPath)) {
                 mkdir($dest . $dirPath, 0777, true);
             }
             if (file_put_contents($dest . $infos['name'], $infos['data'])) {
                 $result[] = $dest . $infos['name'];
             }
         }
         if ($infos) {
             chmod($dest . $infos['name'], 0777);
         }
     }
     if (is_file($tmp)) {
         unlink($tmp);
     }
     return $result;
 }
开发者ID:harshzalavadiya,项目名称:fatak,代码行数:32,代码来源:targz.php


示例3: import

 public function import()
 {
     // It might not look like it, but it is actually compatible to
     // uncompressed files.
     $gzFileHandler = gzopen($this->file, 'r');
     Model\DownloadIntent::delete_all();
     Model\DownloadIntentClean::delete_all();
     $batchSize = 1000;
     $batch = array();
     while (!gzeof($gzFileHandler)) {
         $line = gzgets($gzFileHandler);
         list($id, $user_agent_id, $media_file_id, $request_id, $accessed_at, $source, $context, $geo_area_id, $lat, $lng) = explode(",", $line);
         $batch[] = array($user_agent_id, $media_file_id, $request_id, $accessed_at, $source, $context, $geo_area_id, $lat, $lng);
         if (count($batch) >= $batchSize) {
             self::save_batch_to_db($batch);
             $batch = [];
         }
     }
     gzclose($gzFileHandler);
     // save last batch to db
     self::save_batch_to_db($batch);
     \Podlove\Analytics\DownloadIntentCleanup::cleanup_download_intents();
     \Podlove\Cache\TemplateCache::get_instance()->setup_purge();
     wp_redirect(admin_url('admin.php?page=podlove_imexport_migration_handle&status=success'));
     exit;
 }
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:26,代码来源:tracking_importer.php


示例4: LoadBackUp

function LoadBackUp()
{
    global $SAMSConf;
    global $USERConf;
    $DB = new SAMSDB();
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    if ($USERConf->ToWebInterfaceAccess("C") != 1) {
        exit;
    }
    PageTop("reark_48.jpg", "{$backupbuttom_2_loadbase_LoadBackUp_1}");
    if (($finp = gzopen($_FILES['userfile']['tmp_name'], "r")) != NULL) {
        while (gzeof($finp) == 0) {
            $string = gzgets($finp, 10000);
            $QUERY = strtok($string, ";");
            if (strstr($QUERY, "#") == FALSE) {
                echo "{$QUERY}<BR>";
                $num_rows = $DB->samsdb_query($QUERY . ";");
            }
            $count++;
        }
    }
    print "<SCRIPT>\n";
    print "  parent.lframe.location.href=\"lframe.php\"; \n";
    print "</SCRIPT> \n";
}
开发者ID:ruNovel,项目名称:sams2,代码行数:26,代码来源:configbuttom_5_restore.php


示例5: update_database

 public static function update_database()
 {
     set_time_limit(0);
     $outFile = self::get_upload_file_path();
     // for download_url()
     require_once ABSPATH . 'wp-admin/includes/file.php';
     $tmpFile = \download_url(self::SOURCE_URL);
     if (is_wp_error($tmpFile)) {
         die($tmpFile->get_error_message());
     }
     $zh = gzopen($tmpFile, 'rb');
     $h = fopen($outFile, 'wb');
     if (!$zh) {
         die('Downloaded file could not be opened for reading.');
     }
     if (!$h) {
         die(sprintf('Database could not be written (%s).', $outFile));
     }
     while (!gzeof($zh)) {
         fwrite($h, gzread($zh, 4096));
     }
     gzclose($zh);
     fclose($h);
     unlink($tmpFile);
     if (!self::is_db_valid()) {
         die(sprintf('Checksum does not match (%s).', $outFile));
     }
 }
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:28,代码来源:geo_ip.php


示例6: gzpassthru

 function gzpassthru($fp)
 {
     while (!gzeof($fp)) {
         print gzred($fp, 1 << 20);
     }
     gzclose($fp);
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:7,代码来源:fakezlib.php


示例7: feof

 function feof($fp)
 {
     if ($this->has_gzip()) {
         return gzeof($fp);
     }
     return feof($fp);
 }
开发者ID:bluedanbob,项目名称:wordpress,代码行数:7,代码来源:wordpress.php


示例8: wp_all_import_get_gz

 function wp_all_import_get_gz($filename, $use_include_path = 0, $targetDir = false)
 {
     $type = 'csv';
     $uploads = wp_upload_dir();
     $targetDir = !$targetDir ? wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY) : $targetDir;
     $tmpname = wp_unique_filename($targetDir, strlen(basename($filename)) < 30 ? basename($filename) : time());
     $localPath = $targetDir . '/' . urldecode(sanitize_file_name($tmpname));
     $fp = @fopen($localPath, 'w');
     $file = @gzopen($filename, 'rb', $use_include_path);
     if ($file) {
         $first_chunk = true;
         while (!gzeof($file)) {
             $chunk = gzread($file, 1024);
             if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) {
                 $type = 'xml';
                 $first_chunk = false;
             }
             // if it's a 1st chunk, then chunk <? symbols to detect XML file
             @fwrite($fp, $chunk);
         }
         gzclose($file);
     } else {
         $tmpname = wp_unique_filename($targetDir, strlen(basename($filename)) < 30 ? basename($filename) : time());
         $localGZpath = $targetDir . '/' . urldecode(sanitize_file_name($tmpname));
         $request = get_file_curl($filename, $localGZpath, false, true);
         if (!is_wp_error($request)) {
             $file = @gzopen($localGZpath, 'rb', $use_include_path);
             if ($file) {
                 $first_chunk = true;
                 while (!gzeof($file)) {
                     $chunk = gzread($file, 1024);
                     if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) {
                         $type = 'xml';
                         $first_chunk = false;
                     }
                     // if it's a 1st chunk, then chunk <? symbols to detect XML file
                     @fwrite($fp, $chunk);
                 }
                 gzclose($file);
             }
             @unlink($localGZpath);
         } else {
             return $request;
         }
     }
     @fclose($fp);
     if (preg_match('%\\W(gz)$%i', basename($localPath))) {
         if (@rename($localPath, str_replace('.gz', '.' . $type, $localPath))) {
             $localPath = str_replace('.gz', '.' . $type, $localPath);
         }
     } else {
         if (@rename($localPath, $localPath . '.' . $type)) {
             $localPath = $localPath . '.' . $type;
         }
     }
     return array('type' => $type, 'localPath' => $localPath);
 }
开发者ID:lizbur10,项目名称:js_finalproject,代码行数:57,代码来源:wp_all_import_get_gz.php


示例9: decompress

 public function decompress()
 {
     $tgzFilePath = $this->getPath();
     if (!file_exists($tgzFilePath)) {
         throw new Exception(sprintf('File %s does not exist!', $tgzFilePath));
     }
     if (!is_readable($tgzFilePath)) {
         throw new Exception(sprintf('File %s is not readable!', $tgzFilePath));
     }
     // Open .tgz file for reading
     $gzHandle = @gzopen($tgzFilePath, 'rb');
     if (!$gzHandle) {
         throw new Exception(sprintf('Could not open %s for reading!', $tgzFilePath));
     }
     jimport('joomla.filesystem.file');
     while (!gzeof($gzHandle)) {
         if ($block = gzread($gzHandle, 512)) {
             $meta['filename'] = trim(substr($block, 0, 99));
             $meta['filesize'] = octdec(substr($block, 124, 12));
             if ($bytes = $meta['filesize'] % 512) {
                 $meta['nullbytes'] = 512 - $bytes;
             } else {
                 $meta['nullbytes'] = 0;
             }
             if ($meta['filesize']) {
                 // Make sure our extension is .xml
                 if (($ext = JFile::getExt($meta['filename'])) != 'xml') {
                     throw new Exception(sprintf('Attempted to extract a file with an invalid extension (%s) - archive might be damaged.', preg_replace('#[^a-z0-9]#is', '', $ext)));
                 }
                 // Make sure file does not contain invalid characters
                 if (preg_match('/[^a-z_\\-0-9]/i', JFile::stripExt($meta['filename']))) {
                     throw new Exception('Attempted to extract a file with invalid characters in its name.');
                 }
                 $chunk = 1024 * 1024;
                 $left = $meta['filesize'];
                 $fHandle = @fopen($this->path . '/' . $meta['filename'], 'wb');
                 if (!$fHandle) {
                     throw new Exception(sprintf('Could not write data to file %s!', htmlentities($meta['filename'], ENT_COMPAT, 'utf-8')));
                 }
                 do {
                     $left = $left - $chunk;
                     if ($left < 0) {
                         $chunk = $left + $chunk;
                     }
                     $data = gzread($gzHandle, $chunk);
                     fwrite($fHandle, $data);
                 } while ($left > 0);
                 fclose($fHandle);
             }
             if ($meta['nullbytes'] > 0) {
                 gzread($gzHandle, $meta['nullbytes']);
             }
         }
     }
     gzclose($gzHandle);
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:56,代码来源:restore.php


示例10: _Open

 /**
 * Open the file containing the backup data
 * @return String a String containing the DB Dump 
 * @access private
 */
 function _Open()
 {
     $fp = gzopen($this->filename, "rb") or die("Error. No se pudo abrir el archivo {$this->filename}");
     while (!gzeof($fp)) {
         $line = gzgets($fp, 1024);
         $SQL .= "{$line}";
     }
     gzclose($fp);
     return $SQL;
 }
开发者ID:Fengtalk,项目名称:yiqicms,代码行数:15,代码来源:iam_restore.php


示例11: decompressFile

 /**
  * @param $fileName
  * @param $outputFilePath
  */
 private function decompressFile($fileName, $outputFilePath)
 {
     $gz = gzopen($fileName, 'rb');
     $outputFile = fopen($outputFilePath, 'wb');
     while (!gzeof($gz)) {
         fwrite($outputFile, gzread($gz, 4096));
     }
     fclose($outputFile);
     gzclose($gz);
 }
开发者ID:MaximeThoonsen,项目名称:CravlerMaxMindGeoIpBundle,代码行数:14,代码来源:UpdateDatabaseCommand.php


示例12: __endoffile

 function __endoffile()
 {
     switch ($this->type) {
         case 'gz':
             return gzeof($this->handle);
             break;
         case 'file':
             return feof($this->handle);
             break;
     }
 }
开发者ID:Sajaki,项目名称:wowroster_dev,代码行数:11,代码来源:luaparser.php


示例13: gzUncompressFile

function gzUncompressFile($srcName, $dstName)
{
    $sfp = gzopen($srcName, "rb");
    $fp = fopen($dstName, "w");
    while (!gzeof($sfp)) {
        $string = gzread($sfp, 4096);
        fwrite($fp, $string, strlen($string));
    }
    gzclose($sfp);
    fclose($fp);
}
开发者ID:scrow,项目名称:WX4AKQ_Offline_Tools,代码行数:11,代码来源:fo_download.inc.php


示例14: downloadRemoteDataStore

 /**
  * Download remote data store
  *
  * Used by the mautic:iplookup:update_data command and form fetch button (if applicable) to update local IP data stores
  *
  * @return bool
  */
 public function downloadRemoteDataStore()
 {
     $connector = HttpFactory::getHttp();
     $package = $this->getRemoteDateStoreDownloadUrl();
     try {
         $data = $connector->get($package);
     } catch (\Exception $exception) {
         $this->logger->error('Failed to fetch remote IP data: ' . $exception->getMessage());
     }
     $tempTarget = $this->cacheDir . '/' . basename($package);
     $tempExt = strtolower(pathinfo($package, PATHINFO_EXTENSION));
     $localTarget = $this->getLocalDataStoreFilepath();
     $localTargetExt = strtolower(pathinfo($localTarget, PATHINFO_EXTENSION));
     try {
         $success = false;
         switch (true) {
             case $localTargetExt === $tempExt:
                 $success = (bool) file_put_contents($localTarget, $data->body);
                 break;
             case 'gz' == $tempExt:
                 if (function_exists('gzdecode')) {
                     $success = (bool) file_put_contents($localTarget, gzdecode($data->body));
                 } elseif (function_exists('gzopen')) {
                     if (file_put_contents($tempTarget, $data->body)) {
                         $bufferSize = 4096;
                         // read 4kb at a time
                         $file = gzopen($tempTarget, 'rb');
                         $outFile = fopen($localTarget, 'wb');
                         while (!gzeof($file)) {
                             fwrite($outFile, gzread($file, $bufferSize));
                         }
                         fclose($outFile);
                         gzclose($file);
                         @unlink($tempTarget);
                         $success = true;
                     }
                 }
                 break;
             case 'zip' == $tempExt:
                 file_put_contents($tempTarget, $data->body);
                 $zipper = new \ZipArchive();
                 $zipper->open($tempTarget);
                 $success = $zipper->extractTo($localTarget);
                 $zipper->close();
                 @unlink($tempTarget);
                 break;
         }
     } catch (\Exception $exception) {
         error_log($exception);
         $success = false;
     }
     return $success;
 }
开发者ID:Yame-,项目名称:mautic,代码行数:60,代码来源:AbstractLocalDataLookup.php


示例15: gunzip

function gunzip($file)
{
    $file = @gzopen($file, 'rb', 0);
    if ($file) {
        $data = '';
        while (!gzeof($file)) {
            $data .= gzread($file, 1024);
        }
        gzclose($file);
    }
    return $data;
}
开发者ID:h16o2u9u,项目名称:rtoss,代码行数:12,代码来源:lib_gzip.php


示例16: gunzip

 function gunzip($infile, $outfile)
 {
     $string = null;
     $zp = gzopen($infile, "r");
     while (!gzeof($zp)) {
         $string .= gzread($zp, 4096);
     }
     gzclose($zp);
     $fp = fopen($outfile, "w");
     fwrite($fp, $string, strlen($string));
     fclose($fp);
 }
开发者ID:BackupTheBerlios,项目名称:idb,代码行数:12,代码来源:compression.php


示例17: gzgetcont

function gzgetcont($f)
{
    $d = "";
    $fo = gzopen($f, 'r');
    if ($fo) {
        while (!gzeof($fo)) {
            $d .= gzgets($fo);
        }
    }
    gzclose($fo);
    return $d;
}
开发者ID:iamanony,项目名称:b64trans,代码行数:12,代码来源:func.php


示例18: unGZip

 /**
  * Extracts single gzipped file. If archive will contain more then one file you will got a mess.
  *
  * @param $archive
  * @param $destination
  * @return int
  */
 public function unGZip($archive, $destination)
 {
     $buffer_size = 4096;
     // read 4kb at a time
     $archive = gzopen($archive, 'rb');
     $dat = fopen($destination, 'wb');
     while (!gzeof($archive)) {
         fwrite($dat, gzread($archive, $buffer_size));
     }
     fclose($dat);
     gzclose($archive);
     return filesize($destination);
 }
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:20,代码来源:Data.php


示例19: install

 static function install($source, $filename)
 {
     $target = SIMPLE_EXT . substr($filename, 0, -3);
     setup::out("{t}Download{/t}: " . $source . " ...");
     if ($fz = gzopen($source, "r") and $fp = fopen($target, "w")) {
         $i = 0;
         while (!gzeof($fz)) {
             $i++;
             setup::out(".", false);
             if ($i % 160 == 0) {
                 setup::out();
             }
             fwrite($fp, gzread($fz, 16384));
         }
         gzclose($fz);
         fclose($fp);
     } else {
         sys_die("{t}Error{/t}: gzopen [2] " . $source);
     }
     setup::out();
     if (!file_exists($target) or filesize($target) == 0 or filesize($target) % 10240 != 0) {
         sys_die("{t}Error{/t}: file-check [3] Filesize: " . filesize($target) . " " . $target);
     }
     setup::out(sprintf("{t}Processing %s ...{/t}", basename($target)));
     $tar_object = new Archive_Tar($target);
     $tar_object->setErrorHandling(PEAR_ERROR_PRINT);
     $tar_object->extract(SIMPLE_EXT);
     $file_list = $tar_object->ListContent();
     if (!is_array($file_list) or !isset($file_list[0]["filename"]) or !is_dir(SIMPLE_EXT . $file_list[0]["filename"])) {
         sys_die("{t}Error{/t}: tar [4] " . $target);
     }
     self::update_modules_list();
     $ext_folder = db_select_value("simple_sys_tree", "id", "anchor=@anchor@", array("anchor" => "extensions"));
     foreach ($file_list as $file) {
         sys_chmod(SIMPLE_EXT . $file["filename"]);
         setup::out(sprintf("{t}Processing %s ...{/t}", SIMPLE_EXT . $file["filename"]));
         if (basename($file["filename"]) == "install.php") {
             setup::out("");
             require SIMPLE_EXT . $file["filename"];
             setup::out("");
         }
         if (basename($file["filename"]) == "readme.txt") {
             $data = file_get_contents(SIMPLE_EXT . $file["filename"]);
             setup::out(nl2br("\n" . q($data) . "\n"));
         }
         if (!empty($ext_folder) and basename($file["filename"]) == "folders.xml") {
             setup::out(sprintf("{t}Processing %s ...{/t}", "folder structure"));
             folders::create_default_folders(SIMPLE_EXT . $file["filename"], $ext_folder, false);
         }
     }
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:51,代码来源:extensions.php


示例20: decompressFile

 /**
  * @param $filename
  * @return string
  */
 protected function decompressFile($filename)
 {
     $dataDir = $this->getDataDirectoryPath();
     $zip = gzopen($filename, 'rb');
     $outputUncompressedTempFileName = tempnam($dataDir, 'dbupdate');
     $outputUncompressedTempFile = fopen($outputUncompressedTempFileName, 'wb');
     $bufferSize = 4096;
     while (!gzeof($zip)) {
         fwrite($outputUncompressedTempFile, gzread($zip, $bufferSize));
     }
     fclose($outputUncompressedTempFile);
     gzclose($zip);
     return $outputUncompressedTempFileName;
 }
开发者ID:andreyors,项目名称:geoip2,代码行数:18,代码来源:UpdateDatabaseCommand.php



注:本文中的gzeof函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gzfile函数代码示例发布时间:2022-05-15
下一篇:
PHP gzencode函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap