本文整理汇总了PHP中extractFile函数的典型用法代码示例。如果您正苦于以下问题:PHP extractFile函数的具体用法?PHP extractFile怎么用?PHP extractFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extractFile函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: langPackUnpack
function langPackUnpack($unpack_type, $full_file)
{
global $sugar_config;
global $base_upgrade_dir;
global $base_tmp_upgrade_dir;
$manifest = array();
if (!empty($full_file)) {
$base_filename = pathinfo(urldecode($full_file), PATHINFO_FILENAME);
} else {
return "Empty filename supplied";
}
$manifest_file = extractManifest($full_file, $base_tmp_upgrade_dir);
if ($unpack_type == 'module') {
$license_file = extractFile($full_file, 'LICENSE.txt', $base_tmp_upgrade_dir);
}
if (is_file($manifest_file)) {
if ($unpack_type == 'module' && is_file($license_file)) {
copy($license_file, $base_upgrade_dir . '/' . $unpack_type . '/' . $base_filename . "-license.txt");
}
copy($manifest_file, $base_upgrade_dir . '/' . $unpack_type . '/' . $base_filename . "-manifest.php");
require_once $manifest_file;
validate_manifest($manifest);
$upgrade_zip_type = $manifest['type'];
mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
$target_path = "{$base_upgrade_dir}/{$upgrade_zip_type}/{$base_filename}";
$target_manifest = $target_path . "-manifest.php";
if (isset($manifest['icon']) && $manifest['icon'] != "") {
$icon_location = extractFile($full_file, $manifest['icon'], $base_tmp_upgrade_dir);
$path_parts = pathinfo($icon_location);
copy($icon_location, $target_path . "-icon." . $path_parts['extension']);
}
// move file from uploads to cache
// FIXME: where should it be?
if (copy($full_file, $target_path . ".zip")) {
copy($manifest_file, $target_manifest);
unlink($full_file);
// remove tempFile
return "The file {$base_filename} has been uploaded.<br>\n";
} else {
unlinkTempFiles($manifest_file, $full_file);
return "There was an error uploading the file, please try again!<br>\n";
}
} else {
die("The zip file is missing a manifest.php file. Cannot proceed.");
}
unlinkTempFiles($manifest_file, '');
}
开发者ID:stefano6310,项目名称:SuiteCRM,代码行数:47,代码来源:install_utils.php
示例2: extractManifest
function extractManifest($zip_file)
{
return extractFile($zip_file, "manifest.php");
}
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:4,代码来源:UpgradeWizardCommon.php
示例3: extractManifest
function extractManifest($zip_file)
{
logThis('extracting manifest.');
return extractFile($zip_file, "manifest.php");
}
开发者ID:omusico,项目名称:sugar_work,代码行数:5,代码来源:uw_utils.php
示例4: langPackUnpack
function langPackUnpack($unpack_type = 'langpack', $full_file = '')
{
global $sugar_config;
global $base_upgrade_dir;
global $base_tmp_upgrade_dir;
$manifest = array();
if (!empty($full_file)) {
$tempFile = $full_file;
$base_filename = urldecode($tempFile);
$base_filename = preg_replace("#\\\\#", "/", $base_filename);
$base_filename = basename($base_filename);
} else {
$tempFile = getcwd() . '/' . $sugar_config['upload_dir'] . $_FILES['language_pack']['name'];
$base_filename = $_FILES['language_pack']['name'];
}
$manifest_file = extractManifest($tempFile, $base_tmp_upgrade_dir);
if ($unpack_type == 'module') {
$license_file = extractFile($tempFile, 'LICENSE.txt', $base_tmp_upgrade_dir);
}
if (is_file($manifest_file)) {
if ($unpack_type == 'module' && is_file($license_file)) {
copy($license_file, getcwd() . '/' . $sugar_config['upload_dir'] . 'upgrades/' . $unpack_type . '/' . remove_file_extension($base_filename) . "-license.txt");
}
copy($manifest_file, getcwd() . '/' . $sugar_config['upload_dir'] . 'upgrades/' . $unpack_type . '/' . remove_file_extension($base_filename) . "-manifest.php");
require_once $manifest_file;
validate_manifest($manifest);
$upgrade_zip_type = $manifest['type'];
// exclude the bad permutations
/*if($upgrade_zip_type != "langpack") {
unlinkTempFiles($manifest_file, $tempFile);
die( "You can only upload module packs, theme packs, and language packs on this page." );
}*/
//$base_filename = urldecode( $_REQUEST['language_pack_escaped'] );
$base_filename = preg_replace("#\\\\#", "/", $base_filename);
$base_filename = basename($base_filename);
mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
$target_path = getcwd() . "/{$base_upgrade_dir}/{$upgrade_zip_type}/{$base_filename}";
$target_manifest = remove_file_extension($target_path) . "-manifest.php";
if (isset($manifest['icon']) && $manifest['icon'] != "") {
$icon_location = extractFile($tempFile, $manifest['icon'], $base_tmp_upgrade_dir);
$path_parts = pathinfo($icon_location);
copy($icon_location, remove_file_extension($target_path) . "-icon." . $path_parts['extension']);
}
// move file from cache/upload to cache/upload/langpack
if (copy($tempFile, $target_path)) {
copy($manifest_file, $target_manifest);
unlink($tempFile);
// remove tempFile
return "The file {$base_filename} has been uploaded.<br>\n";
} else {
unlinkTempFiles($manifest_file, $tempFile);
return "There was an error uploading the file, please try again!<br>\n";
}
} else {
die("The zip file is missing a manifest.php file. Cannot proceed.");
}
unlinkTempFiles($manifest_file, '');
}
开发者ID:klr2003,项目名称:sourceread,代码行数:58,代码来源:install_utils.php
示例5: logThis
$upgrade_zip_type = $manifest['type'];
// exclude the bad permutations
if ($upgrade_zip_type != "patch") {
logThis('ERROR: incorrect patch type found: ' . $upgrade_zip_type);
unlinkTempFiles();
$out = "<b><span class='error'>{$mod_strings['ERR_UW_ONLY_PATCHES']}</span></b><br />";
break;
}
$base_filename = preg_replace("#\\\\#", "/", $base_filename);
$base_filename = basename($base_filename);
mkdir_recursive("{$base_upgrade_dir}/{$upgrade_zip_type}");
$target_path = "{$base_upgrade_dir}/{$upgrade_zip_type}/{$base_filename}";
$target_manifest = remove_file_extension($target_path) . "-manifest.php";
if (isset($manifest['icon']) && $manifest['icon'] != "") {
logThis('extracting icons.');
$icon_location = extractFile($tempFile, $manifest['icon']);
$path_parts = pathinfo($icon_location);
copy($icon_location, remove_file_extension($target_path) . "-icon." . $path_parts['extension']);
}
if (copy($tempFile, $target_path)) {
logThis('copying manifest.php to final destination.');
copy($manifest_file, $target_manifest);
$out .= "<b>{$base_filename} {$mod_strings['LBL_UW_FILE_UPLOADED']}.</b><br>\n";
} else {
logThis('ERROR: cannot copy manifest.php to final destination.');
$out .= "<b><span class='error'>{$mod_strings['ERR_UW_UPLOAD_ERR']}</span></b><br />";
break;
}
} else {
logThis('ERROR: no manifest.php file found!');
unlinkTempFiles();
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:31,代码来源:upload.php
示例6: saveFile
saveFile($_POST);
break;
case "getContent":
getContent($_POST);
break;
case "deleteFile":
deleteFile($_POST);
break;
case "renameFile":
renameFile($_POST);
break;
case "downloadFile":
downloadFile($_POST);
break;
case "extractFile":
extractFile($_POST);
break;
case "uploadFile":
uploadFile($_POST);
break;
case "changePermissions":
changePermissions($_POST);
break;
case "zipnload":
zipnload($_POST);
break;
case "remoteUpload":
remoteUpload($_POST);
break;
case "deleteMultipleFiles":
deleteMultipleFiles($_POST);
开发者ID:httvncoder,项目名称:ifm,代码行数:31,代码来源:ifm.php
示例7: realpath
<?php
$root = realpath('.');
$to = $root;
$zipRemove = true;
$scan = scandir($root);
rsort($scan);
foreach ($scan as $key => $value) {
$infos = pathinfo($value);
if ($infos["extension"] == "zip") {
$file = $root . "/" . $value;
extractFile($file, $to, $zipRemove);
return false;
}
}
function extractFile($file, $to, $zipRemove = false)
{
$zip = new ZipArchive();
$zip->open($file);
$zip->extractTo($to);
$zip->close();
$zipRemove ? unlink($file) : "";
}
$r = array('infotype' => "success", 'msg' => "ok");
echo json_encode($r);
开发者ID:rodbox,项目名称:rodbox3,代码行数:25,代码来源:zip_extract.php
注:本文中的extractFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论