本文整理汇总了PHP中zipfile类的典型用法代码示例。如果您正苦于以下问题:PHP zipfile类的具体用法?PHP zipfile怎么用?PHP zipfile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了zipfile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$filenamezip = APP_ROOT_PATH . "public/mobile_goods_down_region_conf.zip";
if (!file_exists($filenamezip)) {
$sql = "select id,pid,name,'' as postcode,'' as py from " . DB_PREFIX . "delivery_region";
$list = $GLOBALS['db']->getAll($sql);
$root = array();
$root['return'] = 1;
$region_list = "";
foreach ($list as $item) {
$sql = "insert into region_conf(id,pid,name,postcode,py) values('{$item['id']}','{$item['pid']}','{$item['name']}','{$item['postcode']}','{$item['py']}');";
if ($region_list == "") {
$region_list = $sql;
} else {
$region_list = $region_list . "\n" . $sql;
}
}
$ziper = new zipfile();
$ziper->addFile($region_list, "region_conf.txt");
$ziper->output($filenamezip);
}
$root = array();
$root['return'] = 1;
if (file_exists($filenamezip)) {
$root['file_exists'] = 1;
} else {
$root['file_exists'] = 0;
}
$sql = "select count(*) as num from " . DB_PREFIX . "delivery_region";
$root['region_num'] = $GLOBALS['db']->getOne($sql);
//配置地区数量
$root['file_url'] = get_domain() . APP_ROOT . "/../public/mobile_goods_down_region_conf.zip";
$root['file_size'] = abs(filesize($filenamezip));
output($root);
}
示例2: makezip
function makezip($zipname, $ad_dir)
{
$zipfilename = $zipname;
$zip_subfolder = '';
$ad_dir = $ad_dir;
// form is posted, handle it
$zipfile = new zipfile();
// generate _settings into zip file
//$zipfile ->addFile( stripcslashes( $settings ), $zip_subfolder . '/_settings.php' );
if ($handle = opendir($ad_dir)) {
while (false !== ($file = readdir($handle))) {
if (!is_dir($file) && $file != "." && $file != "..") {
$f_tmp = @fopen($ad_dir . '/' . $file, 'r');
if ($f_tmp) {
$dump_buffer = fread($f_tmp, filesize($ad_dir . '/' . $file));
$zipfile->addFile($dump_buffer, $zip_subfolder . '/' . $file);
fclose($f_tmp);
}
}
}
$dump_buffer = $zipfile->file();
// write the file to disk:
$file_pointer = fopen($zipfilename, 'w');
if ($file_pointer) {
fwrite($file_pointer, $dump_buffer, strlen($dump_buffer));
fclose($file_pointer);
}
// response zip archive to browser:
header('Pragma: public');
header('Content-type: application/zip');
header('Content-length: ' . strlen($dump_buffer));
header('Content-Disposition: attachment; filename="' . $zipfilename . '"');
echo $dump_buffer;
}
}
示例3: createZip
/**
* Create ZIP archive.
*
* @param array $files An array of files to put in archive.
* @param boolean $save Whether to save zip data to file or not?
* @param string $name Name with path to store archive file.
*
* @return mixed Zip data if $save is FALSE, or boolean value if $save is TRUE
*/
public static function createZip($files, $save = false, $name = '')
{
if (is_array($files) and count($files)) {
// Initialize variables
$zip = new zipfile();
$root = str_replace('\\', '/', JPATH_ROOT);
foreach ($files as $file) {
// Add file to zip archive
if (is_array($file)) {
foreach ($file as $k => $v) {
$zip->create_file($v, $k);
}
} elseif (is_string($file) and is_readable($file)) {
// Initialize file path
$file = str_replace('\\', '/', $file);
$path = str_replace($root, '', $file);
$zip->create_file(JFile::read($file), $path);
}
}
// Save zip archive to file system
if ($save) {
if (!JFolder::create($dest = dirname($name))) {
throw new Exception(JText::sprintf('JSN_EXTFW_GENERAL_FOLDER_NOT_EXISTS', $dest));
}
if (!JFile::write($name, $zip->zipped_file())) {
throw new Exception(JText::sprintf('JSN_EXTFW_GENERAL_CANNOT_WRITE_FILE', $name));
}
return true;
} else {
return $zip->zipped_file();
}
}
return false;
}
示例4: zipFiles
function zipFiles($zipname, $files)
{
$zipfile = new zipfile();
// $zipfile->add_dir("files/");
for ($f = 0; $f < count($files); $f++) {
$filename = $files[$f][0];
$filedata = $files[$f][1];
$zipfile->add_file($filedata, $filename);
}
File::throwFile($zipname, $zipfile->file());
}
示例5: get_projects_archive
function get_projects_archive($projects, $shedule)
{
require_once "zip.lib.php";
$zipfile = new zipfile();
foreach ($projects as $fname => $project) {
$fname = 'Projects/' . $fname;
$zipfile->addFile($project, $fname);
}
$zipfile->addFile($shedule, 'shedule.xml');
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=projects-' . date("d-m-Y-H-i-s") . '.zip');
echo $zipfile->file();
$zipfile->close();
}
示例6: restore
function restore($log_id, $files_dir = false)
{
zipfile::read(SYS_ROOT . 'var/trash/' . $log_id . '_conf.zip');
zipfile::extract(SYS_ROOT . 'conf/');
if ($files_dir) {
zipfile::read(SYS_ROOT . 'var/trash/' . $log_id . '_files.zip');
zipfile::extract($files_dir);
}
dump::restore(SYS_ROOT . 'var/trash/' . $log_id . '_base.zip');
}
示例7: ft_zip_page
/**
* Implementation of hook_page.
* Zip current file/folder
*/
function ft_zip_page($act)
{
global $ft;
if ($act == 'zip') {
$_REQUEST['file'] = trim(ft_stripslashes($_REQUEST['file']));
// nom de fichier/repertoire
$zip = new zipfile();
if ($ft["plugins"]["zip"]["filebuffer"]) {
$zip->setOutFile($ft["plugins"]["zip"]["filebuffer"]);
}
$substr_base = strlen(ft_get_dir()) + 1;
foreach (ft_zip_getfiles(ft_get_dir() . '/' . $_REQUEST['file']) as $file) {
$filename = substr($file, $substr_base);
$filesize = filesize($file);
if ($filesize > 0) {
$fp = fopen($file, 'r');
$content = fread($fp, $filesize);
fclose($fp);
} else {
$content = '';
}
$zip->addfile($content, $filename);
}
if ($ft["plugins"]["zip"]["filebuffer"]) {
$zip->finish();
$filesize = filesize($ft["plugins"]["zip"]["filebuffer"]);
} else {
$archive = $zip->file();
$filesize = strlen($archive);
}
header('Content-Type: application/x-zip');
header('Content-Disposition: inline; filename="' . $_REQUEST['file'] . '.zip"');
header('Content-Length: ' . $filesize);
if ($ft["plugins"]["zip"]["filebuffer"]) {
readfile($ft["plugins"]["zip"]["filebuffer"]);
unlink($ft["plugins"]["zip"]["filebuffer"]);
} else {
echo $archive;
}
exit;
}
}
示例8: PMA_createOpenDocument
/**
* Minimalistic creator of OASIS OpenDocument
*
* @param string desired MIME type
* @param string document content
*
* @return string OASIS OpenDocument data
*
* @access public
*/
function PMA_createOpenDocument($mime, $data)
{
$zipfile = new zipfile();
$zipfile->addFile($mime, 'mimetype');
$zipfile->addFile($data, 'content.xml');
$zipfile->addFile('<?xml version="1.0" encoding="UTF-8"?' . '>' . '<office:document-meta ' . 'xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" ' . 'xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" ' . 'office:version="1.0">' . '<office:meta>' . '<meta:generator>phpMyAdmin ' . PMA_VERSION . '</meta:generator>' . '<meta:initial-creator>phpMyAdmin ' . PMA_VERSION . '</meta:initial-creator>' . '<meta:creation-date>' . strftime('%Y-%m-%dT%H:%M:%S') . '</meta:creation-date>' . '</office:meta>' . '</office:document-meta>', 'meta.xml');
$zipfile->addFile('<?xml version="1.0" encoding="UTF-8"?' . '>' . '<office:document-styles ' . $GLOBALS['OpenDocumentNS'] . 'office:version="1.0">' . '<office:font-face-decls>' . '<style:font-face style:name="Arial Unicode MS" svg:font-family="\'Arial Unicode MS\'" style:font-pitch="variable"/>' . '<style:font-face style:name="DejaVu Sans1" svg:font-family="\'DejaVu Sans\'" style:font-pitch="variable"/>' . '<style:font-face style:name="HG Mincho Light J" svg:font-family="\'HG Mincho Light J\'" style:font-pitch="variable"/>' . '<style:font-face style:name="DejaVu Serif" svg:font-family="\'DejaVu Serif\'" style:font-family-generic="roman" style:font-pitch="variable"/>' . '<style:font-face style:name="Thorndale" svg:font-family="Thorndale" style:font-family-generic="roman" style:font-pitch="variable"/>' . '<style:font-face style:name="DejaVu Sans" svg:font-family="\'DejaVu Sans\'" style:font-family-generic="swiss" style:font-pitch="variable"/>' . '</office:font-face-decls>' . '<office:styles>' . '<style:default-style style:family="paragraph">' . '<style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="page"/>' . '<style:text-properties style:use-window-font-color="true" style:font-name="DejaVu Serif" fo:font-size="12pt" fo:language="en" fo:country="US" style:font-name-asian="DejaVu Sans1" style:font-size-asian="12pt" style:language-asian="none" style:country-asian="none" style:font-name-complex="DejaVu Sans1" style:font-size-complex="12pt" style:language-complex="none" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>' . '</style:default-style>' . '<style:style style:name="Standard" style:family="paragraph" style:class="text"/>' . '<style:style style:name="Text_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">' . '<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0835in"/>' . '</style:style>' . '<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_body" style:class="text">' . '<style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" fo:keep-with-next="always"/>' . '<style:text-properties style:font-name="DejaVu Sans" fo:font-size="14pt" style:font-name-asian="DejaVu Sans1" style:font-size-asian="14pt" style:font-name-complex="DejaVu Sans1" style:font-size-complex="14pt"/>' . '</style:style>' . '<style:style style:name="Heading_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_body" style:class="text" style:default-outline-level="1">' . '<style:text-properties style:font-name="Thorndale" fo:font-size="24pt" fo:font-weight="bold" style:font-name-asian="HG Mincho Light J" style:font-size-asian="24pt" style:font-weight-asian="bold" style:font-name-complex="Arial Unicode MS" style:font-size-complex="24pt" style:font-weight-complex="bold"/>' . '</style:style>' . '<style:style style:name="Heading_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_body" style:class="text" style:default-outline-level="2">' . '<style:text-properties style:font-name="DejaVu Serif" fo:font-size="18pt" fo:font-weight="bold" style:font-name-asian="DejaVu Sans1" style:font-size-asian="18pt" style:font-weight-asian="bold" style:font-name-complex="DejaVu Sans1" style:font-size-complex="18pt" style:font-weight-complex="bold"/>' . '</style:style>' . '</office:styles>' . '<office:automatic-styles>' . '<style:page-layout style:name="pm1">' . '<style:page-layout-properties fo:page-width="8.2673in" fo:page-height="11.6925in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1in" fo:margin-bottom="1in" fo:margin-left="1.25in" fo:margin-right="1.25in" style:writing-mode="lr-tb" style:footnote-max-height="0in">' . '<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>' . '</style:page-layout-properties>' . '<style:header-style/>' . '<style:footer-style/>' . '</style:page-layout>' . '</office:automatic-styles>' . '<office:master-styles>' . '<style:master-page style:name="Standard" style:page-layout-name="pm1"/>' . '</office:master-styles>' . '</office:document-styles>', 'styles.xml');
$zipfile->addFile('<?xml version="1.0" encoding="UTF-8"?' . '>' . '<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0">' . '<manifest:file-entry manifest:media-type="' . $mime . '" manifest:full-path="/"/>' . '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="content.xml"/>' . '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>' . '<manifest:file-entry manifest:media-type="text/xml" manifest:full-path="styles.xml"/>' . '</manifest:manifest>', 'META-INF/manifest.xml');
return $zipfile->file();
}
示例9: installApp
function installApp()
{
if ($_FILES['app']['name']) {
if ($_FILES['app']['type'] != 'application/zip') {
s::set('ERRORS', '<ul><li>Неверный формат архива приложения.</li></ul>');
} else {
$arr = explode('.', $_FILES['app']['name']);
if (count($arr) < 5) {
s::set('ERRORS', '<ul><li>Неверный формат архива приложения.</li></ul>');
} else {
define('INSTALL_APP', $arr[0]);
define('INSTALL_APP_VERSION', $arr[1] . '.' . $arr[2] . '.' . $arr[3]);
files::fullRemoveDir(SYS_ROOT . 'var/tmp/apps/');
$path = SYS_ROOT . 'var/tmp/apps/';
zipfile::read($_FILES['app']['tmp_name']);
zipfile::extract($path);
$install_file = $path . 'install.php';
if (!file_exists($install_file)) {
s::set('ERRORS', '<ul><li>Не найден инсталляционый файл приложения.</li></ul>');
} else {
include $install_file;
// copy lang files
$tmp_lang_dir = SYS_ROOT . 'var/tmp/apps/langs/';
$lang_dir = SYS_ROOT . 'langs/admin/';
if (file_exists($lang_dir)) {
$array = files::getFiles($tmp_lang_dir);
foreach ($array as $v) {
if (!file_exists($lang_dir . $v)) {
copy($tmp_lang_dir . $v, $lang_dir . $v);
} else {
$lang = ini::parse($tmp_lang_dir . $v);
ini::parse($lang_dir . $v);
ini::add($lang);
ini::write();
}
}
}
// copy app files
$dir = SYS_ROOT . 'var/tmp/apps/' . INSTALL_APP . '/';
$new_dir = SYS_ROOT . 'apps/' . INSTALL_APP . '/';
files::copyDir($dir, $new_dir);
// clear tmp
files::fullRemoveDir(SYS_ROOT . 'var/tmp/apps/');
headers::app('manage');
}
}
}
}
}
示例10: create
function create($description)
{
global $addslashes, $moduleFactory;
if ($this->getNumAvailable() >= AT_COURSE_BACKUPS) {
return FALSE;
}
$timestamp = time();
$zipfile = new zipfile();
$package_identifier = VERSION . "\n\n\n" . 'Do not change the first line of this file it contains the ATutor version this backup was created with.';
$zipfile->add_file($package_identifier, 'atutor_backup_version', $timestamp);
// backup course properties. ONLY BANNER FOR NOW.
require_once AT_INCLUDE_PATH . 'classes/CSVExport.class.php';
$CSVExport = new CSVExport();
$now = time();
$sql = 'SELECT banner
FROM ' . TABLE_PREFIX . 'courses
WHERE course_id=' . $this->course_id;
$properties = $CSVExport->export($sql, $course_id);
$zipfile->add_file($properties, 'properties.csv', $now);
// backup modules
$modules = $moduleFactory->getModules(AT_MODULE_STATUS_ENABLED | AT_MODULE_STATUS_DISABLED);
$keys = array_keys($modules);
foreach ($keys as $module_name) {
$module =& $modules[$module_name];
$module->backup($this->course_id, $zipfile);
}
$zipfile->close();
$system_file_name = md5($timestamp);
if (!is_dir(AT_BACKUP_DIR)) {
@mkdir(AT_BACKUP_DIR);
}
if (!is_dir(AT_BACKUP_DIR . $this->course_id)) {
@mkdir(AT_BACKUP_DIR . $this->course_id);
}
$zipfile->write_file(AT_BACKUP_DIR . $this->course_id . DIRECTORY_SEPARATOR . $system_file_name . '.zip');
$row['description'] = $addslashes($description);
$row['contents'] = addslashes(serialize($table_counters));
$row['system_file_name'] = $system_file_name;
$row['file_size'] = $zipfile->get_size();
$row['file_name'] = $this->generateFileName();
$this->add($row);
return TRUE;
}
示例11: basename
$repair_tables_link = basename(ADMIN_PATH) . '?cp=r_repair&case=tables&' . $GET_FORM_KEY;
$status_file_link = basename(ADMIN_PATH) . '?cp=r_repair&case=status_file&' . $GET_FORM_KEY;
$stylee = "admin_repair";
break;
// We, I mean developrts and support team anywhere, need sometime
// some inforamtion about the status of Kleeja .. this will give
// a zip file contain those data ..
// We, I mean developrts and support team anywhere, need sometime
// some inforamtion about the status of Kleeja .. this will give
// a zip file contain those data ..
case 'status_file':
if (isset($_GET['_ajax_'])) {
exit('Ajax is forbidden here !');
}
include PATH . 'includes/plugins.php';
$zip = new zipfile();
#kleeja version
$zip->create_file(KLEEJA_VERSION, 'kleeja_version.txt');
#grab configs
$d_config = $config;
unset($d_config['h_key'], $d_config['ftp_info']);
$zip->create_file(var_export($d_config, true), 'config_vars.txt');
unset($d_config);
#php info
ob_start();
@phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
$zip->create_file($phpinfo, 'phpinfo.html');
unset($phpinfo);
#config file data
示例12: sendfile
public function sendfile()
{
$themename = isset($_POST['themename']) ? trim($_POST['themename']) : '';
if ($themename != '') {
$themename = tlinkgenerator::i()->filterfilename($themename);
}
if ($themename == '') {
$themename = time();
}
$path = "themes/generator-{$themename}/";
litepublisher::$classes->include_file(litepublisher::$paths->libinclude . 'zip.lib.php');
$zip = new zipfile();
$themedir = litepublisher::$paths->plugins . 'themegenerator' . DIRECTORY_SEPARATOR . $this->type . DIRECTORY_SEPARATOR;
$args = new targs();
$colors = "[themecolors]\nthemename = \"{$themename}\"\n";
foreach ($this->colors as $name => $value) {
$colors .= "{$name} = \"{$value}\"\n";
$args->{$name} = $value;
}
foreach (array('headerurl', 'logourl') as $name) {
if (strbegin($this->colors[$name], 'http://')) {
$basename = substr($this->colors[$name], strrpos($this->colors[$name], '/') + 1);
$filename = litepublisher::$paths->files . 'themegen' . DIRECTORY_SEPARATOR . $basename;
$zip->addFile(file_get_contents($filename), $path . 'images/' . $basename);
$args->{$name} = 'images/' . $basename;
}
}
$res = $this->res;
$css = strtr(tfilestorage::getfile($res . 'scheme.tml'), $args->data);
$zip->addFile($colors, $path . 'colors.ini');
$filelist = tfiler::getfiles($themedir);
foreach ($filelist as $filename) {
$content = tfilestorage::getfile($themedir . $filename);
switch ($filename) {
case 'style.css':
$content .= $css;
break;
case 'about.ini':
$content = str_replace('name = generator', "name = generator-{$themename}", $content);
break;
}
$zip->addFile($content, $path . $filename);
}
$result = $zip->file();
if (ob_get_level()) {
@ob_end_clean();
}
header('HTTP/1.1 200 OK', true, 200);
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=generator.theme.' . $themename . '.zip');
header('Content-Length: ' . strlen($result));
header('Last-Modified: ' . date('r'));
Header('Cache-Control: no-cache, must-revalidate');
Header('Pragma: no-cache');
echo $result;
exit;
}
示例13: explode
list($dbhost, $dbport) = explode(':', $dbhost);
$query = $db->query("SHOW VARIABLES LIKE 'basedir'");
list(, $mysql_base) = $db->fetch_array($query, MYSQL_NUM);
$dumpfile = addslashes(dirname(dirname(__FILE__))).'/'.$backupfilename.'.sql';
@unlink($dumpfile);
$mysqlbin = $mysql_base == '/' ? '' : addslashes($mysql_base).'bin/';
@shell_exec($mysqlbin.'mysqldump --force --quick '.($db->version() > '4.1' ? '--skip-opt --create-options' : '-all').' --add-drop-table'.($extendins == 1 ? ' --extended-insert' : '').''.($db->version() > '4.1' && $sqlcompat == 'MYSQL40' ? ' --compatible=mysql40' : '').' --host="'.$dbhost.($dbport ? (is_numeric($dbport) ? ' --port='.$dbport : ' --socket="'.$dbport.'"') : '').'" --user="'.$dbuser.'" --password="'.$dbpw.'" "'.$dbname.'" '.$tablesstr.' > '.$dumpfile);
if(@file_exists($dumpfile)) {
if($usezip) {
require_once DISCUZ_ROOT.'admin/zip.func.php';
$zip = new zipfile();
$zipfilename = $backupfilename.'.zip';
$fp = fopen($dumpfile, "r");
$content = @fread($fp, filesize($dumpfile));
fclose($fp);
$zip->addFile($idstring."# <?exit();?>\n ".$setnames."\n #".$content, basename($dumpfile));
$fp = fopen($zipfilename, 'w');
@fwrite($fp, $zip->file());
fclose($fp);
@unlink($dumpfile);
@touch('./forumdata/'.$backupdir.'/index.htm');
$filename = $backupfilename.'.zip';
unset($sqldump, $zip, $content);
cpmsg('database_export_zip_succeed');
} else {
if(@is_writeable($dumpfile)) {
示例14: array
$file_id = array();
for ($i = 0; $i < sizeof($ids); $i++) {
//validar que existan
$r = InstanciasController::BuscarPorId($ids[$i]);
if (is_null($r)) {
$page->addComponent("La instancia " . $ids[$i] . " no existe");
$page->render();
exit;
}
}
$result = InstanciasController::Respaldar_Instancias($ids);
//Respaldar_Instancias recibe como params un array
if (strlen($result) > 0) {
die("<html><head><meta HTTP-EQUIV='REFRESH' content='3; url=instancias.bd.php'><title>Error al descargar, perimisos</title></head><body><h1><center>" . $result . "</center></h1></body></html>");
}
$f = new zipfile();
for ($i = 0; $i < sizeof($ids); $i++) {
//$f->add_file(file_get_contents($files[$i]), $file_id[$i] . ".sql");
$final_path = str_replace("server", "static_content/db_backups", POS_PATH_TO_SERVER_ROOT);
$dbs_instance = trim(shell_exec("ls -lat -m1 " . $final_path . "| grep " . $ids[$i] . ".sql"));
Logger::log("Respaldos encontrados: " . $dbs_instance);
/*dbs_instance almacena una cadena con un listado donde se encuentran archivos que tengan la teminacion
con el id de la instancia y .sql, ademas de que la lista viene ordenada de mas reciente a antiguo
la lista seria como lo siguiente:
1353617611_pos_instance_82.sql 1353608687_pos_instance_82.sql 1353608206_pos_instance_82.sql 1353608191_pos_instance_82.sql
en found se coloca un array y en cada posicion el nombre de cada respaldo
*/
$found = preg_split("/[\\s,]+/", $dbs_instance, -1, PREG_SPLIT_NO_EMPTY);
//Logger::log("No archivos: ".count($found));
if (count($found) < 1) {
Logger::log("Error al restaurar la instancias " . $ids[$i] . ", no hay un respaldo existente");
示例15: substr
for ($i = 0; $i < count($company_name); $i++) {
$str_company_ids .= $company_name[$i] . ", ";
}
$str_company_ids = substr($str_company_ids, 0, strlen($str_company_ids) - 2);
$str_where_condition = "where userId in ({$str_company_ids})";
}
if ($str_where_condition == "") {
$str_where_condition = " where 1 ";
} else {
$str_where_condition .= " and gateway_id = -1";
}
$str_qry_company = "select * from cs_companydetails {$str_where_condition} order by companyname";
//$str_qry_company ="select * from cs_companydetails where userId = $company_name";
// print($str_qry_company);
$rst_qry_company = mysql_query($str_qry_company);
$zipfile = new zipfile();
while ($arr_qry_company = mysql_fetch_array($rst_qry_company)) {
$str_company_name = $arr_qry_company['companyname'];
$company_id = $arr_qry_company['userId'];
$i_max_file_size_MB = 3;
$dir_company_name = "Documents/" . func_replace_invalid_literals($str_company_name);
//$dir_company_name = "Documents/";
//print("company= ".$dir_company_name);
// add the subdirectory ... important!
if ($is_app != "") {
$str_legal_company_name = $arr_qry_company['legal_name'];
$company_type = $arr_qry_company['company_type'];
$other_company_type = $arr_qry_company['other_company_type'];
if ($company_type == "other") {
$company_type = $other_company_type;
}