当前位置: 首页>>代码示例>>PHP>>正文


PHP FileHelper::createZip方法代码示例

本文整理汇总了PHP中FileHelper::createZip方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHelper::createZip方法的具体用法?PHP FileHelper::createZip怎么用?PHP FileHelper::createZip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileHelper的用法示例。


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

示例1: foreach

  *	Lines created calculate
  */
 $totallinescalculated = 0;
 foreach ($totallinescreated as $totallineseach) {
     $totallinescalculated += $totallineseach;
 }
 // 15 seconds per line - round up or down..
 $totaltimesaved = round($totallinescalculated / 4);
 // minutes
 /**
  *	le Zip Up
  */
 // Set zip path
 $packagename = 'mod_' . $varObject->filename . '-v.' . $varObject->version . '-joomla_' . $varObject->jversion . '.zip';
 // Create the zip package
 $filescreatedlist = FileHelper::createZip($filestozip, $folderusersmodulestmp . $packagename, true, $folderusersmodulestmp);
 // Get size of package
 $bytes = filesize($folderusersmodulestmp . $packagename);
 $filecreatedcount = count($filescreatedlist);
 // Format numbers
 $filecreatedcount_format = number_format($filecreatedcount);
 $totallinescalculated_format = number_format($totallinescalculated);
 // Connect to database
 $database = new Database(HOST, DBNAME, DBUSER, DBPASS);
 // Posted data
 $posted_date = date('Y-m-d H:i:s');
 // Insert into database
 $varObject->description = str_replace("'", "\\'", $varObject->description);
 $create_package_record = array('uid' => $_SESSION['uid'], 'midparent' => $varObject->midparent, 'm_name' => $varObject->name, 'm_file_name' => $varObject->filename, 'version' => $varObject->version, 'jversion' => $varObject->jversion, 'brversion' => $varObject->brversion, 'description' => $varObject->description, 'license' => $varObject->license, 'copyright' => $varObject->copyright, 'author' => $varObject->author, 'author_email' => $varObject->author_email, 'author_url' => $varObject->author_url, 'date_created' => $posted_date, 'filesize' => $bytes, 'lines_created' => $totallinescalculated, 'files_created' => $filecreatedcount, 'minutes_saved' => $totaltimesaved, 'download_count' => 1);
 $mid = $database->insert('br_modules', $create_package_record);
 $filesize = FileHelper::formatBytes($bytes);
开发者ID:calebnance,项目名称:black-rabbit-os,代码行数:31,代码来源:module-create.php

示例2: foreach

  *	Lines created calculate
  */
 $totallinescalculated = 0;
 foreach ($totallinescreated as $totallineseach) {
     $totallinescalculated = $totallinescalculated + $totallineseach;
 }
 // 15 seconds per line - round up or down..
 $totaltimesaved = round($totallinescalculated / 4 / 60);
 $filecreatedcount = 0;
 /**
  *	le Zip Up
  */
 // Set zip path
 $packagename = $varObject->com_main . '-v.' . $varObject->version . '-joomla_' . $varObject->j_version . '.zip';
 // Create the zip package
 $filescreatedlist = FileHelper::createZip($filestozip, $datedfolder . $packagename, true, $datedfolder);
 // Database store activity
 // Connect to database and open it
 $newpackagename = $packagename;
 $currentdate = date("Y-m-d");
 $currentdate = " AND date_created >= '" . $currentdate . " 00:00:00' AND date_created < '" . $currentdate . " 23:59:59'";
 $packagenamecheck = $database->select('br_packages', '*', 'package="' . $packagename . '"' . $currentdate);
 // Check if packagename is there today
 if ($packagenamecheck) {
     $newpackagename = str_replace('.zip', '-1.zip', $packagename);
     $packagenamecheck = $database->select('br_packages', '*', 'package="' . $newpackagename . '"' . $currentdate);
     // Check if packagename is there today
     if ($packagenamecheck) {
         $newpackagename = str_replace('.zip', '-2.zip', $packagename);
         $packagenamecheck = $database->select('br_packages', '*', 'package="' . $newpackagename . '"' . $currentdate);
         // Check if packagename is there today
开发者ID:calebnance,项目名称:black-rabbit-os,代码行数:31,代码来源:create.php


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