本文整理汇总了PHP中UpgradeHistory类的典型用法代码示例。如果您正苦于以下问题:PHP UpgradeHistory类的具体用法?PHP UpgradeHistory怎么用?PHP UpgradeHistory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UpgradeHistory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkForExisting
/**
* Given a name check if it exists in the table
* @param name the unique key from the manifest
* @param id the id of the item you are comparing to
* @return upgrade_history object if found, null otherwise
*/
function checkForExisting($patch_to_check)
{
$uh = new UpgradeHistory();
if ($patch_to_check != null) {
if (empty($patch_to_check->id_name)) {
$where = " WHERE name = '{$patch_to_check->name}' ";
} else {
$where = " WHERE id_name = '{$patch_to_check->id_name}' ";
}
if (!empty($patch_to_check->id)) {
$where .= " AND id != '{$patch_to_check->id}' ";
} else {
$where .= " AND id is not null ";
}
$query = "SELECT id FROM " . $this->table_name . " " . $where;
$result = $uh->db->query($query);
if (empty($result)) {
return null;
}
$row = $uh->db->fetchByAssoc($result);
if (empty($row)) {
return null;
}
if (!empty($row['id'])) {
return $uh->retrieve($row['id']);
}
}
return null;
}
示例2: run
public function run()
{
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$packages = $pm->getinstalledPackages(array('module'));
foreach ($packages as $pack) {
if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
$uh = new UpgradeHistory();
$uh->name = $pack['name'];
$history = $uh->checkForExisting($uh);
$this->filesToRemove[] = "custom/Extension/application/Ext/Include/{$history->id_name}.php";
$history->delete();
$this->fileToDelete($this->filesToRemove);
$this->log("Useless files of {$pack['name']} v{$pack['version']} removed");
}
}
foreach ($pm->getPackagesInStaging() as $pack) {
if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
$file = UploadStream::getFSPath(hashToFile($pack['file']));
$this->fileToDelete($file);
foreach (array('manifest', 'icon') as $meta) {
$this->fileToDelete(pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . "-{$meta}.php");
}
}
}
}
示例3: run
public function run()
{
// if error was encountered, script should have died before now
$new_upgrade = new UpgradeHistory();
$new_upgrade->filename = $this->context['zip'];
if (!empty($this->context['zip_as_dir'])) {
$new_upgrade->md5sum = trim(file_get_contents($this->context['zip'] . DIRECTORY_SEPARATOR . 'md5sum'));
} else {
if (file_exists($this->context['zip'])) {
$new_upgrade->md5sum = md5_file($this->context['zip']);
} else {
// if file is not there, just md5 the filename
$new_upgrade->md5sum = md5($this->context['zip']);
}
}
$dup = $this->db->getOne("SELECT id FROM upgrade_history WHERE md5sum='{$new_upgrade->md5sum}'");
if ($dup) {
$this->error("Duplicate install for package, md5: {$new_upgrade->md5sum}");
// Not failing it - by now there's no point, we're at the end anyway
return;
}
$new_upgrade->name = pathinfo($this->context['zip'], PATHINFO_FILENAME);
$new_upgrade->description = $this->manifest['description'];
$new_upgrade->type = 'patch';
$new_upgrade->version = $this->to_version;
$new_upgrade->status = "installed";
$new_upgrade->manifest = base64_encode(serialize($this->manifest));
$new_upgrade->save();
}
示例4: UW_get_patch_for_file
/**
* Returns manifest patch from upgrade history of the given install file
*
* @param string $install_file
* @return array
*/
function UW_get_patch_for_file($install_file)
{
$history = new UpgradeHistory();
$md5 = md5_file($install_file);
$matches = $history->findByMd5($md5);
$history = array_shift($matches);
if ($history && $history->patch) {
return unserialize(base64_decode($history->patch));
}
return array();
}
示例5: testCheckForExistingSQL
public function testCheckForExistingSQL()
{
$patchToCheck = new stdClass();
$patchToCheck->name = 'abc';
$patchToCheck->id = '';
$GLOBALS['db']->query("INSERT INTO upgrade_history (id, name, md5sum, date_entered) VALUES\n('444','abc','444','2008-12-20 08:08:20') ");
$GLOBALS['db']->query("INSERT INTO upgrade_history (id, name, md5sum, date_entered) VALUES\n('555','abc','555','2008-12-20 08:08:20')");
$uh = new UpgradeHistory();
$return = $uh->checkForExisting($patchToCheck);
$this->assertContains($return->id, array('444', '555'));
$patchToCheck->id = '555';
$return = $uh->checkForExisting($patchToCheck);
$this->assertEquals($return->id, '444');
$GLOBALS['db']->query("delete from upgrade_history where id='444'");
$GLOBALS['db']->query("delete from upgrade_history where id='555'");
}
示例6: display
public function display()
{
global $sugar_flavor;
global $current_user;
$mod_strings = return_module_language($GLOBALS['current_language'], 'Home');
$this->ss->assign('mod', $mod_strings);
$this->ss->assign("sugarFlavor", $sugar_flavor);
//check the upgrade history to see if this instance has been upgraded, if so then present the calendar url message
//if no upgrade history exists then we can assume this is an install and we do not show the calendar message
$uh = new UpgradeHistory();
$upgrade = count($uh->getAll()) > 0 ? true : false;
if ($upgrade) {
//create the url with the user id and scrolltocal flag. This will be passed into language string
$urlForString = $mod_strings['LBL_TOUR_CALENDAR_URL_1'];
$urlForString .= '<br><a href="index.php?module=Users&action=EditView&record=' . $current_user->id . '&scrollToCal=true" target="_blank">';
$urlForString .= $mod_strings['LBL_TOUR_CALENDAR_URL_2'] . '</a>';
$this->ss->assign('view_calendar_url', $urlForString);
}
$this->ss->display('modules/Home/tour.tpl');
}
示例7: getValidPatchName
/**
* gets valid patch file names that exist in upload/upgrade/patch/
*/
function getValidPatchName($returnFull = true)
{
global $base_upgrade_dir;
global $mod_strings;
global $uh;
global $sugar_version;
global $sugar_config;
$uh = new UpgradeHistory();
list($base_upgrade_dir, $base_tmp_upgrade_dir) = getUWDirs();
$return = array();
// scan for new files (that are not installed)
logThis('finding new files for upgrade');
$upgrade_content = '';
$upgrade_contents = findAllFiles($base_upgrade_dir, array(), false, 'zip');
//other variations of zip file i.e. ZIP, zIp,zIP,Zip,ZIp,ZiP
$ready = "<ul>\n";
$ready .= "\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_NAME']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_TYPE']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_VERSION']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_PUBLISHED']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_UNINSTALLABLE']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_DESCRIPTION']}</b>\n\t\t\t\t</td>\n\t\t\t</tr>";
$disabled = '';
// assume old patches are there.
$upgradeToVersion = array();
// fill with valid patches - we will only use the latest qualified found patch
// cn: bug 10609 - notices for uninitialized variables
$icon = '';
$name = '';
$type = '';
$version = '';
$published_date = '';
$uninstallable = '';
$description = '';
$disabled = '';
foreach ($upgrade_contents as $upgrade_content) {
if (!preg_match("#.*\\.zip\$#i", $upgrade_content)) {
continue;
}
$the_base = basename($upgrade_content);
$the_md5 = md5_file($upgrade_content);
$md5_matches = $uh->findByMd5($the_md5);
/* If a patch is in the /patch dir AND has no record in the upgrade_history table we assume that it's the one we want.
* Edge-case: manual upgrade with a FTP of a patch; UH table has no entry for it. Assume nothing. :( */
if (0 == sizeof($md5_matches)) {
$target_manifest = remove_file_extension($upgrade_content) . '-manifest.php';
require_once $target_manifest;
if (empty($manifest['version'])) {
logThis("*** Potential error: patch found with no version [ {$upgrade_content} ]");
continue;
}
if (!isset($manifest['type']) || $manifest['type'] != 'patch') {
logThis("*** Potential error: patch found with either no 'type' or non-patch type [ {$upgrade_content} ]");
continue;
}
$upgradeToVersion[$manifest['version']] = urlencode($upgrade_content);
$name = empty($manifest['name']) ? $upgrade_content : $manifest['name'];
$version = empty($manifest['version']) ? '' : $manifest['version'];
$published_date = empty($manifest['published_date']) ? '' : $manifest['published_date'];
$icon = '';
$description = empty($manifest['description']) ? 'None' : $manifest['description'];
$uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes';
$type = getUITextForType($manifest['type']);
$manifest_type = $manifest['type'];
if (empty($manifest['icon'])) {
$icon = getImageForType($manifest['type']);
} else {
$path_parts = pathinfo($manifest['icon']);
$icon = "<!--not_in_theme!--><img src=\"" . remove_file_extension($upgrade_content) . "-icon." . $path_parts['extension'] . "\">";
}
}
}
// cn: bug 10488 use the NEWEST upgrade/patch available when running upgrade wizard.
ksort($upgradeToVersion);
$upgradeToVersion = array_values($upgradeToVersion);
$newest = array_pop($upgradeToVersion);
$_SESSION['install_file'] = urldecode($newest);
// in-case it was there from a prior.
logThis("*** UW using [ {$_SESSION['install_file']} ] as source for patch files.");
$cleanUpgradeContent = urlencode($_SESSION['install_file']);
// cn: 10606 - cannot upload a patch file since this returned always.
if (!empty($cleanUpgradeContent)) {
$ready .= "<tr><td>{$icon}</td><td>{$name}</td><td>{$type}</td><td>{$version}</td><td>{$published_date}</td><td>{$uninstallable}</td><td>{$description}</td>\n";
$ready .= <<<eoq
\t <td>
\t\t\t\t<form action="index.php" method="post">
\t\t\t\t\t<input type="hidden" name="module" value="UpgradeWizard">
\t\t\t\t\t<input type="hidden" name="action" value="index">
\t\t\t\t\t<input type="hidden" name="step" value="{$_REQUEST['step']}">
\t\t\t\t\t<input type="hidden" name="run" value="delete">
\t \t\t<input type=hidden name="install_file" value="{$cleanUpgradeContent}" />
\t \t\t<input type=submit value="{$mod_strings['LBL_BUTTON_DELETE']}" />
\t\t\t\t</form>
\t\t\t</td></table>
eoq;
$disabled = "DISABLED";
}
if (empty($cleanUpgradeContent)) {
$ready .= "<tr><td colspan='7'><i>None</i></td>\n";
$ready .= "</table>\n";
}
$ready .= "<br></ul>\n";
//.........这里部分代码省略.........
示例8: UpgradeHistory
if (isset($installdefs) && isset($installdefs['id'])) {
$id_name = $installdefs['id'];
}
if (isset($manifest['dependencies'])) {
$dependencies = $manifest['dependencies'];
}
if (isset($manifest['remove_tables'])) {
$remove_tables = $manifest['remove_tables'];
}
if ($remove_tables != 'prompt') {
$hidden_fields .= "<input type=hidden name=\"remove_tables\" value='" . $remove_tables . "'>";
}
if (file_exists($readme_file) || !empty($manifest['readme'])) {
$found_readme = true;
}
$uh = new UpgradeHistory();
//check dependencies first
if (!empty($dependencies)) {
$not_found = $uh->checkDependencies($dependencies);
if (!empty($not_found) && count($not_found) > 0) {
die($mod_strings['ERR_UW_NO_DEPENDENCY'] . "[" . implode(',', $not_found) . "]");
}
//fi
}
switch ($install_type) {
case "full":
case "patch":
if (!is_writable("config.php")) {
die($mod_strings['ERR_UW_CONFIG']);
}
break;
示例9: get_required_upgrades
function get_required_upgrades($soapclient, $session)
{
global $sugar_config, $sugar_version;
require_once 'vendor/nusoap//nusoap.php';
$errors = array();
$upgrade_history = new UpgradeHistory();
$upgrade_history->disable_row_level_security = true;
$installeds = $upgrade_history->getAllOrderBy('date_entered ASC');
$history = array();
require_once 'soap/SoapError.php';
$error = new SoapError();
foreach ($installeds as $installed) {
$history[] = array('id' => $installed->id, 'filename' => $installed->filename, 'md5' => $installed->md5sum, 'type' => $installed->type, 'status' => $installed->status, 'version' => $installed->version, 'date_entered' => $installed->date_entered, 'error' => $error->get_soap_array());
}
$result = $soapclient->call('get_required_upgrades', array('session' => $session, 'client_upgrade_history' => $history, 'client_version' => $sugar_version));
$tempdir_parent = create_cache_directory("disc_client");
$temp_dir = tempnam($tempdir_parent, "sug");
sugar_mkdir($temp_dir, 0775);
$upgrade_installed = false;
if (empty($soapclient->error_str) && $result['error']['number'] == 0) {
foreach ($result['upgrade_history_list'] as $upgrade) {
$file_result = $soapclient->call('get_encoded_file', array('session' => $session, 'filename' => $upgrade['filename']));
if (empty($soapclient->error_str) && $result['error']['number'] == 0) {
if ($file_result['md5'] == $upgrade['md5']) {
$newfile = write_encoded_file($file_result, $temp_dir);
unzip($newfile, $temp_dir);
global $unzip_dir;
$unzip_dir = $temp_dir;
if (file_exists("{$temp_dir}/manifest.php")) {
require_once "{$temp_dir}/manifest.php";
global $manifest_arr;
$manifest_arr = $manifest;
if (!isset($manifest['offline_client_applicable']) || $manifest['offline_client_applicable'] == true || $manifest['offline_client_applicable'] == 'true') {
if (file_exists("{$temp_dir}/scripts/pre_install.php")) {
require_once "{$temp_dir}/scripts/pre_install.php";
pre_install();
}
if (isset($manifest['copy_files']['from_dir']) && $manifest['copy_files']['from_dir'] != "") {
$zip_from_dir = $manifest['copy_files']['from_dir'];
}
$source = "{$temp_dir}/{$zip_from_dir}";
$dest = getcwd();
copy_recursive($source, $dest);
if (file_exists("{$temp_dir}/scripts/post_install.php")) {
require_once "{$temp_dir}/scripts/post_install.php";
post_install();
}
//save newly installed upgrade
$new_upgrade = new UpgradeHistory();
$new_upgrade->filename = $upgrade['filename'];
$new_upgrade->md5sum = $upgrade['md5'];
$new_upgrade->type = $upgrade['type'];
$new_upgrade->version = $upgrade['version'];
$new_upgrade->status = "installed";
$new_upgrade->save();
$upgrade_installed = true;
}
}
}
}
}
}
return $upgrade_installed;
}
示例10: UpgradeHistory
case "Disable":
$file_action = "disabled";
$uh = new UpgradeHistory();
$the_md5 = md5_file($install_file);
$md5_matches = $uh->findByMd5($the_md5);
if (sizeof($md5_matches) == 0) {
die("{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} {$install_file}.");
}
foreach ($md5_matches as $md5_match) {
$md5_match->enabled = 0;
$md5_match->save();
}
break;
case "Enable":
$file_action = "enabled";
$uh = new UpgradeHistory();
$the_md5 = md5_file($install_file);
$md5_matches = $uh->findByMd5($the_md5);
if (sizeof($md5_matches) == 0) {
die("{$mod_strings['ERR_UW_NO_UPDATE_RECORD']} {$install_file}.");
}
foreach ($md5_matches as $md5_match) {
$md5_match->enabled = 1;
$md5_match->save();
}
break;
}
// present list to user
?>
<form action="<?php
print $form_action;
示例11: get_required_upgrades
function get_required_upgrades($session, $client_upgrade_history, $client_version)
{
// files might be big
global $sugar_config;
$error = new SoapError();
if (!validate_authenticated($session)) {
$error->set_error('invalid_login');
return array('upgrade_history_list' => array(), 'error' => $error->get_soap_array());
}
global $current_user;
$upgrade_history = new UpgradeHistory();
$installeds = $upgrade_history->getAllOrderBy('date_entered ASC');
$history = array();
$client_ver = explode('.', $client_version);
foreach ($installeds as $installed) {
$installed_ver = explode('.', $installed->version);
if (count($installed_ver) >= 3) {
if (is_server_version_greater($client_ver, $installed_ver) == true) {
$found = false;
foreach ($client_upgrade_history as $client_history) {
if ($client_history['md5'] == $installed->md5sum) {
$found = true;
break;
}
}
if (!$found) {
//now check to be sure that this is available as an offline client upgrade
$manifest_file = getManifest($installed->filename);
if (is_file($manifest_file)) {
require_once $manifest_file;
if (!isset($manifest['offline_client_applicable']) || $manifest['offline_client_applicable'] == true || $manifest['offline_client_applicable'] == 'true') {
$history[] = array('id' => $installed->id, 'filename' => $installed->filename, 'md5' => $installed->md5sum, 'type' => $installed->type, 'status' => $installed->status, 'version' => $installed->version, 'date_entered' => $installed->date_entered, 'error' => $error->get_soap_array());
}
}
}
}
}
}
return array('upgrade_history_list' => $history, 'error' => $error->get_soap_array());
}
示例12: getLangPacks
/**
* searches upgrade dir for lang pack files.
*
* @return string HTML of available lang packs
*/
function getLangPacks($display_commit = true, $types = array('langpack'), $notice_text = '')
{
global $mod_strings;
global $next_step;
global $base_upgrade_dir;
if (empty($notice_text)) {
$notice_text = $mod_strings['LBL_LANG_PACK_READY'];
}
$ret = "<tr><td colspan=7 align=left>{$notice_text}</td></tr>";
//$ret .="<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
$ret .= "<tr>\n <td width='20%' ><b>{$mod_strings['LBL_ML_NAME']}</b></td>\n <td width='15%' ><b>{$mod_strings['LBL_ML_VERSION']}</b></td>\n <td width='15%' ><b>{$mod_strings['LBL_ML_PUBLISHED']}</b></td>\n <td width='15%' ><b>{$mod_strings['LBL_ML_UNINSTALLABLE']}</b></td>\n <td width='20%' ><b>{$mod_strings['LBL_ML_DESCRIPTION']}</b></td>\n <td width='7%' ></td>\n <td width='1%' ></td>\n <td width='7%' ></td>\n </tr>\n";
$files = array();
// duh, new installs won't have the upgrade folders
if (!is_dir($base_upgrade_dir)) {
mkdir_recursive($base_upgrade_dir);
}
$subdirs = array('full', 'langpack', 'module', 'patch', 'theme', 'temp');
foreach ($subdirs as $subdir) {
mkdir_recursive("{$base_upgrade_dir}/{$subdir}");
}
$files = findAllFiles($base_upgrade_dir, $files);
$hidden_input = '';
unset($_SESSION['hidden_input']);
foreach ($files as $file) {
if (!preg_match("#.*\\.zip\$#", $file)) {
continue;
}
// skip installed lang packs
if (isset($_SESSION['INSTALLED_LANG_PACKS']) && in_array($file, $_SESSION['INSTALLED_LANG_PACKS'])) {
continue;
}
// handle manifest.php
$target_manifest = remove_file_extension($file) . '-manifest.php';
$license_file = remove_file_extension($file) . '-license.txt';
include $target_manifest;
if (!empty($types)) {
if (!in_array(strtolower($manifest['type']), $types)) {
continue;
}
}
$md5_matches = array();
if ($manifest['type'] == 'module') {
$uh = new UpgradeHistory();
$upgrade_content = clean_path($file);
$the_base = basename($upgrade_content);
$the_md5 = md5_file($upgrade_content);
$md5_matches = $uh->findByMd5($the_md5);
}
if ($manifest['type'] != 'module' || 0 == sizeof($md5_matches)) {
$name = empty($manifest['name']) ? $file : $manifest['name'];
$version = empty($manifest['version']) ? '' : $manifest['version'];
$published_date = empty($manifest['published_date']) ? '' : $manifest['published_date'];
$icon = '';
$description = empty($manifest['description']) ? 'None' : $manifest['description'];
$uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes';
$manifest_type = $manifest['type'];
$commitPackage = getPackButton('commit', $target_manifest, $file, $next_step);
$deletePackage = getPackButton('remove', $target_manifest, $file, $next_step);
//$ret .="<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
$ret .= "<tr>";
$ret .= "<td width='20%' >" . $name . "</td>";
$ret .= "<td width='15%' >" . $version . "</td>";
$ret .= "<td width='15%' >" . $published_date . "</td>";
$ret .= "<td width='15%' >" . $uninstallable . "</td>";
$ret .= "<td width='20%' >" . $description . "</td>";
if ($display_commit) {
$ret .= "<td width='7%'>{$commitPackage}</td>";
}
$ret .= "<td width='1%'></td>";
$ret .= "<td width='7%'>{$deletePackage}</td>";
$ret .= "</td></tr>";
$clean_field_name = "accept_lic_" . str_replace('.', '_', urlencode(basename($file)));
if (is_file($license_file)) {
//rrs
$ret .= "<tr><td colspan=6>";
$ret .= getLicenseDisplay('commit', $target_manifest, $file, $next_step, $license_file, $clean_field_name);
$ret .= "</td></tr>";
$hidden_input .= "<input type='hidden' name='{$clean_field_name}' id='{$clean_field_name}' value='no'>";
} else {
$hidden_input .= "<input type='hidden' name='{$clean_field_name}' id='{$clean_field_name}' value='yes'>";
}
}
//fi
}
//rof
$_SESSION['hidden_input'] = $hidden_input;
if (count($files) > 0) {
$ret .= "</tr><td colspan=7>";
$ret .= "<form name='commit' action='install.php' method='POST'>\n <input type='hidden' name='current_step' value='{$next_step}'>\n <input type='hidden' name='goto' value='Re-check'>\n <input type='hidden' name='languagePackAction' value='commit'>\n <input type='hidden' name='install_type' value='custom'>\n </form>\n ";
$ret .= "</td></tr>";
} else {
$ret .= "</tr><td colspan=7><i>{$mod_strings['LBL_LANG_NO_PACKS']}</i></td></tr>";
}
return $ret;
}
示例13: UpgradeHistory
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
require_once 'modules/Administration/UpgradeWizardCommon.php';
global $mod_strings;
$uh = new UpgradeHistory();
function unlinkTempFiles()
{
global $sugar_config;
@unlink($_FILES['upgrade_zip']['tmp_name']);
@unlink(getcwd() . '/' . $sugar_config['upload_dir'] . $_FILES['upgrade_zip']['name']);
}
// make sure dirs exist
foreach ($subdirs as $subdir) {
mkdir_recursive("{$base_upgrade_dir}/{$subdir}");
}
// get labels and text that are specific to either Module Loader or Upgrade Wizard
if ($view == "module") {
$uploaddLabel = $mod_strings['LBL_UW_UPLOAD_MODULE'];
$descItemsQueued = $mod_strings['LBL_UW_DESC_MODULES_QUEUED'];
$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
示例14: get_unique_system_id
function get_unique_system_id($session, $unique_key, $system_name = '', $install_method = 'web')
{
global $beanList, $beanFiles, $current_user, $server;
$error = new SoapError();
if (!empty($server->requestHeaders)) {
$header = explode('=', $server->requestHeaders);
$uh = new UpgradeHistory();
if (count($header) == 2 && $uh->is_right_version_greater(explode('.', '5.0.0'), explode('.', $header[1]))) {
$output_list = array();
if (!validate_authenticated($session)) {
$error->set_error('invalid_login');
return array('id' => '', 'error' => $error->get_soap_array());
}
$system = new System();
if ($system->canAddNewOfflineClient()) {
$system->system_key = $unique_key;
$system->user_id = $current_user->id;
$system->system_name = $system_name;
$system->install_method = $install_method;
$system->last_connect_date = TimeDate::getInstance()->nowDb();
$system_id = $system->retrieveNextKey();
if ($system_id == -1) {
$error->set_error('client_deactivated');
}
} else {
$system_id = -1;
$error->set_error('cannot_add_client');
}
} else {
$system_id = -1;
$error->set_error('upgrade_client');
}
} else {
$system_id = -1;
$error->set_error('upgrade_client');
}
return array('id' => $system_id, 'error' => $error->get_soap_array());
}
示例15: updateUpgradeHistory
/**
* creates UpgradeHistory entries
* @param mode string Install or Uninstall
*/
function updateUpgradeHistory()
{
if (isset($_SESSION['INSTALLED_LANG_PACKS']) && count($_SESSION['INSTALLED_LANG_PACKS']) > 0) {
foreach ($_SESSION['INSTALLED_LANG_PACKS'] as $k => $zipFile) {
$new_upgrade = new UpgradeHistory();
$new_upgrade->filename = $zipFile;
$new_upgrade->md5sum = md5_file($zipFile);
$new_upgrade->type = 'langpack';
$new_upgrade->version = $_SESSION['INSTALLED_LANG_PACKS_VERSION'][$k];
$new_upgrade->status = "installed";
$new_upgrade->save();
}
}
}