本文整理汇总了PHP中UpgradeHistory::determineIfUpgrade方法的典型用法代码示例。如果您正苦于以下问题:PHP UpgradeHistory::determineIfUpgrade方法的具体用法?PHP UpgradeHistory::determineIfUpgrade怎么用?PHP UpgradeHistory::determineIfUpgrade使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpgradeHistory
的用法示例。
在下文中一共展示了UpgradeHistory::determineIfUpgrade方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: performInstall
function performInstall($file, $silent = true)
{
global $sugar_config;
global $mod_strings;
global $current_language;
$base_upgrade_dir = sugar_cached("/upgrades");
$base_tmp_upgrade_dir = "{$base_upgrade_dir}/temp";
if (!file_exists($base_tmp_upgrade_dir)) {
mkdir_recursive($base_tmp_upgrade_dir, true);
}
$GLOBALS['log']->debug("INSTALLING: " . $file);
$mi = new ModuleInstaller();
$mi->silent = $silent;
$mod_strings = return_module_language($current_language, "Administration");
$GLOBALS['log']->debug("ABOUT TO INSTALL: " . $file);
if (preg_match("#.*\\.zip\$#", $file)) {
$GLOBALS['log']->debug("1: " . $file);
// handle manifest.php
$target_manifest = remove_file_extension($file) . '-manifest.php';
include $target_manifest;
$GLOBALS['log']->debug("2: " . $file);
$unzip_dir = mk_temp_dir($base_tmp_upgrade_dir);
unzip($file, $unzip_dir);
$GLOBALS['log']->debug("3: " . $unzip_dir);
$id_name = $installdefs['id'];
$version = $manifest['version'];
$uh = new UpgradeHistory();
$previous_install = array();
if (!empty($id_name) & !empty($version)) {
$previous_install = $uh->determineIfUpgrade($id_name, $version);
}
$previous_version = empty($previous_install['version']) ? '' : $previous_install['version'];
$previous_id = empty($previous_install['id']) ? '' : $previous_install['id'];
if (!empty($previous_version)) {
$mi->install($unzip_dir, true, $previous_version);
} else {
$mi->install($unzip_dir);
}
$GLOBALS['log']->debug("INSTALLED: " . $file);
$new_upgrade = new UpgradeHistory();
$new_upgrade->filename = $file;
$new_upgrade->md5sum = md5_file($file);
$new_upgrade->type = $manifest['type'];
$new_upgrade->version = $manifest['version'];
$new_upgrade->status = "installed";
//$new_upgrade->author = $manifest['author'];
$new_upgrade->name = $manifest['name'];
$new_upgrade->description = $manifest['description'];
$new_upgrade->id_name = $id_name;
$serial_manifest = array();
$serial_manifest['manifest'] = isset($manifest) ? $manifest : '';
$serial_manifest['installdefs'] = isset($installdefs) ? $installdefs : '';
$serial_manifest['upgrade_manifest'] = isset($upgrade_manifest) ? $upgrade_manifest : '';
$new_upgrade->manifest = base64_encode(serialize($serial_manifest));
//$new_upgrade->unique_key = (isset($manifest['unique_key'])) ? $manifest['unique_key'] : '';
$new_upgrade->save();
//unlink($file);
}
//fi
}
示例2: die
die($mod_strings['ERR_UW_NO_LANGPACK'] . $install_file);
}
$hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"{$new_lang_name}\"/>";
$new_lang_desc = UpgradeWizardCommon::getLanguagePackName("{$unzip_dir}/{$zip_from_dir}/include/language/{$new_lang_name}.lang.php");
if ($new_lang_desc == "") {
die($mod_strings['ERR_UW_NO_LANG_DESC_1'] . "include/language/{$new_lang_name}.lang.php" . $mod_strings['ERR_UW_NO_LANG_DESC_2'] . "{$install_file}.");
}
$hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"{$new_lang_desc}\"/>";
if (!is_writable("config.php")) {
die($mod_strings['ERR_UW_CONFIG']);
}
break;
case "module":
$previous_install = array();
if (!empty($id_name) & !empty($version)) {
$previous_install = $uh->determineIfUpgrade($id_name, $version);
}
$previous_version = empty($previous_install['version']) ? '' : $previous_install['version'];
$previous_id = empty($previous_install['id']) ? '' : $previous_install['id'];
$show_files = false;
//rrs pull out unique_key
$hidden_fields .= "<input type=hidden name=\"author\" value=\"{$author}\"/>";
$hidden_fields .= "<input type=hidden name=\"name\" value=\"{$name}\"/>";
$hidden_fields .= "<input type=hidden name=\"description\" value=\"{$description}\"/>";
$hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"{$is_uninstallable}\"/>";
$hidden_fields .= "<input type=hidden name=\"id_name\" value=\"{$id_name}\"/>";
$hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"{$previous_version}\"/>";
$hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"{$previous_id}\"/>";
break;
default:
die($mod_strings['ERR_UW_WRONG_TYPE'] . $install_type);