本文整理汇总了PHP中UpgradeHistory::getAllOrderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP UpgradeHistory::getAllOrderBy方法的具体用法?PHP UpgradeHistory::getAllOrderBy怎么用?PHP UpgradeHistory::getAllOrderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpgradeHistory
的用法示例。
在下文中一共展示了UpgradeHistory::getAllOrderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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());
}