本文整理汇总了PHP中extractManifest函数的典型用法代码示例。如果您正苦于以下问题:PHP extractManifest函数的具体用法?PHP extractManifest怎么用?PHP extractManifest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extractManifest函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: buildInstallGrid
function buildInstallGrid($view)
{
$uh = new UpgradeHistory();
$installeds = $uh->getAll();
$upgrades_installed = 0;
$installed_objects = array();
foreach ($installeds as $installed) {
$filename = from_html($installed->filename);
$date_entered = $installed->date_entered;
$type = $installed->type;
$version = $installed->version;
$upgrades_installed++;
$link = "";
switch ($type) {
case "theme":
case "langpack":
case "module":
case "patch":
$manifest_file = extractManifest($filename);
require_once $manifest_file;
$name = empty($manifest['name']) ? $filename : $manifest['name'];
$description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
if (($upgrades_installed == 0 || $uh->UninstallAvailable($installeds, $installed)) && is_file($filename) && !empty($manifest['is_uninstallable'])) {
$link = urlencode($filename);
} else {
$link = 'false';
}
break;
default:
break;
}
if ($view == 'default' && $type != 'patch') {
continue;
}
if ($view == 'module' && $type != 'module' && $type != 'theme' && $type != 'langpack') {
continue;
}
$target_manifest = remove_file_extension($filename) . "-manifest.php";
require_once "{$target_manifest}";
if (isset($manifest['icon']) && $manifest['icon'] != "") {
$manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
$manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
$manifest_icon = clean_path($manifest['icon']);
$icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir) + 1) : $manifest_icon) . "\">";
} else {
$icon = getImageForType($manifest['type']);
}
$installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link);
//print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" );
//print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" );
//print( "</form>\n" );
}
}
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:53,代码来源:PackageManagerDisplay.php
示例3: logThis
}
} else {
if (!move_uploaded_file($_FILES['upgrade_zip']['tmp_name'], getcwd() . '/' . $sugar_config['upload_dir'] . $_FILES['upgrade_zip']['name'])) {
logThis('ERROR: could not move temporary file to final destination!');
unlinkTempFiles();
$out = "<b><span class='error'>{$mod_strings['ERR_UW_NOT_VALID_UPLOAD']}</span></b><br />";
} else {
$tempFile = getcwd() . '/' . $sugar_config['upload_dir'] . $_FILES['upgrade_zip']['name'];
logThis('File uploaded to ' . $tempFile);
$base_filename = urldecode($_REQUEST['upgrade_zip_escaped']);
$perform = true;
}
}
}
if ($perform) {
$manifest_file = extractManifest($tempFile);
if (is_file($manifest_file)) {
require_once $manifest_file;
$error = validate_manifest($manifest);
if (!empty($error)) {
$out = "<b><span class='error'>{$error}</span></b><br />";
break;
}
$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;
}
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:31,代码来源:upload.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: foreach
print "<ul>\n";
print "<table>\n";
print "<tr><th></th><th align=left>{$mod_strings['LBL_ML_NAME']}</th><th align=left>{$mod_strings['LBL_ML_TYPE']}</th><th align=left>{$mod_strings['LBL_ML_VERSION']}</th><th align=left>{$mod_strings['LBL_ML_INSTALLED']}</th><th>{$mod_strings['LBL_ML_DESCRIPTION']}</th><th>{$mod_strings['LBL_ML_ACTION']}</th></tr>\n";
foreach ($installeds as $installed) {
$filename = from_html($installed->filename);
$date_entered = $installed->date_entered;
$type = $installed->type;
$version = $installed->version;
$upgrades_installed++;
$link = "";
switch ($type) {
case "theme":
case "langpack":
case "module":
case "patch":
$manifest_file = extractManifest($filename);
require_once $manifest_file;
$name = empty($manifest['name']) ? $filename : $manifest['name'];
$description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
if (($upgrades_installed == 0 || $uh->UninstallAvailable($installeds, $installed)) && is_file($filename) && !empty($manifest['is_uninstallable'])) {
$link .= "<input type=submit name=\"btn_mode\" onclick=\"this.form.mode.value='Uninstall';this.form.submit();\" value=\"{$mod_strings['LBL_UW_UNINSTALL']}\" />";
$link .= "<input type=hidden name=\"install_file\" value=\"" . urlencode($filename) . "\" />";
$link .= "<input type=hidden name=\"mode\"/>";
} else {
$link = $mod_strings['LBL_UW_NOT_AVAILABLE'];
}
break;
default:
break;
}
if ($view == 'default' && $type != 'patch') {
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:UpgradeWizard.php
注:本文中的extractManifest函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论