当前位置: 首页>>代码示例>>PHP>>正文


PHP compareVersions函数代码示例

本文整理汇总了PHP中compareVersions函数的典型用法代码示例。如果您正苦于以下问题:PHP compareVersions函数的具体用法?PHP compareVersions怎么用?PHP compareVersions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了compareVersions函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

$admin_option_defs['Administration']['password_management'] = array('Password', 'LBL_MANAGE_PASSWORD_TITLE', 'LBL_MANAGE_PASSWORD', './index.php?module=Administration&action=PasswordManager');
$admin_group_header[] = array('LBL_USERS_TITLE', '', false, $admin_option_defs, 'LBL_USERS_DESC');
//Sugar Connect
$admin_option_defs = array();
$license_key = 'no_key';
$admin_option_defs['Administration']['support'] = array('Support', 'LBL_SUPPORT_TITLE', 'LBL_SUPPORT', './index.php?module=Administration&action=SupportPortal&view=support_portal');
//$admin_option_defs['documentation']= array('OnlineDocumentation','LBL_DOCUMENTATION_TITLE','LBL_DOCUMENTATION','./index.php?module=Administration&action=SupportPortal&view=documentation&help_module=Administration&edition='.$sugar_flavor.'&key='.$server_unique_key.'&language='.$current_language);
$admin_option_defs['Administration']['update'] = array('sugarupdate', 'LBL_SUGAR_UPDATE_TITLE', 'LBL_SUGAR_UPDATE', './index.php?module=Administration&action=Updater');
$admin_option_defs['Administration']['documentation'] = array('OnlineDocumentation', 'LBL_DOCUMENTATION_TITLE', 'LBL_DOCUMENTATION', 'javascript:void window.open("index.php?module=Administration&action=SupportPortal&view=documentation&help_module=Administration&edition=' . $sugar_flavor . '&key=' . $server_unique_key . '&language=' . $current_language . '", "helpwin","width=600,height=600,status=0,resizable=1,scrollbars=1,toolbar=0,location=0")');
if (!empty($license->settings['license_latest_versions'])) {
    $encodedVersions = $license->settings['license_latest_versions'];
    $versions = unserialize(base64_decode($encodedVersions));
    include 'sugar_version.php';
    if (!empty($versions)) {
        foreach ($versions as $version) {
            if (compareVersions($version['version'], $sugar_version)) {
                $admin_option_defs['Administration']['update'][] = 'red';
                if (!isset($admin_option_defs['Administration']['update']['additional_label'])) {
                    $admin_option_defs['Administration']['update']['additional_label'] = '(' . $version['version'] . ')';
                }
            }
        }
    }
}
$admin_group_header[] = array('LBL_SUGAR_NETWORK_TITLE', '', false, $admin_option_defs, 'LBL_SUGAR_NETWORK_DESC');
//system.
$admin_option_defs = array();
$admin_option_defs['Administration']['configphp_settings'] = array('Administration', 'LBL_CONFIGURE_SETTINGS_TITLE', 'LBL_CONFIGURE_SETTINGS', './index.php?module=Configurator&action=EditView');
$admin_option_defs['Administration']['import'] = array('Import', 'LBL_IMPORT_WIZARD', 'LBL_IMPORT_WIZARD_DESC', './index.php?module=Import&action=step1&import_module=Administration');
$admin_option_defs['Administration']['locale'] = array('Currencies', 'LBL_MANAGE_LOCALE', 'LBL_LOCALE', './index.php?module=Administration&action=Locale&view=default');
if (!defined('TEMPLATE_URL')) {
开发者ID:nicolasbui,项目名称:sugarcrm_dev,代码行数:31,代码来源:adminpaneldefs.php

示例2: matchPackageVersion

function matchPackageVersion($version, $versions)
{
    // Make sure everything is lowercase and clean of spaces and unpleasant history.
    $version = str_replace(array(' ', '2.0rc1-1'), array('', '2.0rc1.1'), strtolower($version));
    $versions = explode(',', str_replace(array(' ', '2.0rc1-1'), array('', '2.0rc1.1'), strtolower($versions)));
    // Perhaps we do accept anything?
    if (in_array('all', $versions)) {
        return true;
    }
    // Loop through each version.
    foreach ($versions as $for) {
        // Wild card spotted?
        if (strpos($for, '*') !== false) {
            $for = str_replace('*', '0dev0', $for) . '-' . str_replace('*', '999', $for);
        }
        // Do we have a range?
        if (strpos($for, '-') !== false) {
            list($lower, $upper) = explode('-', $for);
            // Compare the version against lower and upper bounds.
            if (compareVersions($version, $lower) > -1 && compareVersions($version, $upper) < 1) {
                return true;
            }
        } elseif (compareVersions($version, $for) === 0) {
            return true;
        }
    }
    return false;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:28,代码来源:Subs-Package.php

示例3: testCompareVersions

 /**
  * @dataProvider versionProvider
  * @group 46317
  */
 function testCompareVersions($last_version, $current_version, $expectedResult)
 {
     $this->assertEquals($expectedResult, compareVersions($last_version, $current_version), "Current version: {$current_version}, last available version: {$last_version}");
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:8,代码来源:Bug46317Test.php

示例4: check_now

function check_now($send_usage_info = true, $get_request_data = false, $response_data = false, $from_install = false)
{
    global $sugar_config, $timedate;
    global $db, $license;
    include 'sugar_version.php';
    $return_array = array();
    if (!$from_install && empty($license)) {
        loadLicense(true);
    }
    if (!$response_data) {
        if ($from_install) {
            $info = getBaseSystemInfo(false);
        } else {
            $info = getSystemInfo($send_usage_info);
        }
        require_once 'include/nusoap/nusoap.php';
        $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
        $sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
        $ping = $sclient->call('sugarPing', array());
        if (empty($ping) || $sclient->getError()) {
            if (!$get_request_data) {
                return array(array('version' => $sugar_version, 'description' => "You have the latest version."));
            }
        }
        $key = '4829482749329';
        $encoded = sugarEncode($key, serialize($info));
        if ($get_request_data) {
            $request_data = array('key' => $key, 'data' => $encoded);
            return serialize($request_data);
        }
        $encodedResult = $sclient->call('sugarHome', array('key' => $key, 'data' => $encoded));
    } else {
        $encodedResult = $response_data['data'];
        $key = $response_data['key'];
    }
    if ($response_data || !$sclient->getError()) {
        $serializedResultData = sugarDecode($key, $encodedResult);
        $resultData = unserialize($serializedResultData);
        if ($response_data && empty($resultData)) {
            $resultData = array();
            $resultData['validation'] = 'invalid validation key';
        }
    } else {
        $resultData = array();
        $resultData['versions'] = array();
    }
    if ($response_data || !$sclient->getError()) {
        if (!empty($resultData['msg'])) {
            if (!empty($resultData['msg']['admin'])) {
                $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
            } else {
                $license->saveSetting('license', 'msg_admin', '');
            }
            if (!empty($resultData['msg']['all'])) {
                $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
            } else {
                $license->saveSetting('license', 'msg_all', '');
            }
        } else {
            $license->saveSetting('license', 'msg_admin', '');
            $license->saveSetting('license', 'msg_all', '');
        }
        $license->saveSetting('license', 'last_validation', 'success');
        unset($_SESSION['COULD_NOT_CONNECT']);
    } else {
        $resultData = array();
        $resultData['versions'] = array();
        $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
        $license->saveSetting('license', 'last_validation', 'no_connection');
        if (empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])) {
            $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
            $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified' => false))));
        }
        $_SESSION['COULD_NOT_CONNECT'] = TimeDate::getInstance()->nowDb();
    }
    if (!empty($resultData['versions'])) {
        $license->saveSetting('license', 'latest_versions', base64_encode(serialize($resultData['versions'])));
    } else {
        $resultData['versions'] = array();
        $license->saveSetting('license', 'latest_versions', '');
    }
    if (sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) && compareVersions($sugar_version, $resultData['versions'][0]['version'])) {
        $resultData['versions'][0]['version'] = $sugar_version;
        $resultData['versions'][0]['description'] = "You have the latest version.";
    }
    return $resultData['versions'];
}
开发者ID:alachaum,项目名称:sugarcrm,代码行数:87,代码来源:updater_utils.php

示例5: check_now


//.........这里部分代码省略.........
    if (ocLicense()) {
        return array();
    }
    // END REQUIRED CODE
    $return_array = array();
    if (!$from_install && empty($license)) {
        loadLicense(true);
    }
    if (!$response_data) {
        $systemInfo = SugarSystemInfo::getInstance();
        SugarAutoLoader::requireWithCustom('include/SugarHeartbeat/SugarHeartbeatClient.php', true);
        $sclientClass = SugarAutoLoader::customClass('SugarHeartbeatClient');
        $sclient = new $sclientClass();
        if ($from_install) {
            $info = $systemInfo->getBaseInfo();
        } else {
            $info = $systemInfo->getInfo();
        }
        // This section of code is a portion of the code referred
        // to as Critical Control Software under the End User
        // License Agreement.  Neither the Company nor the Users
        // may modify any portion of the Critical Control Software.
        if (!empty($license->settings['license_key'])) {
            $key = $license->settings['license_key'];
        } else {
            //END REQUIRED CODE
            $key = '4829482749329';
        }
        $encoded = sugarEncode($key, serialize($info));
        if ($get_request_data) {
            $request_data = array('key' => $key, 'data' => $encoded);
            return serialize($request_data);
        }
        $encodedResult = $sclient->sugarHome($key, $info);
    } else {
        $encodedResult = $response_data['data'];
        $key = $response_data['key'];
    }
    if ($response_data || !$sclient->getError()) {
        $serializedResultData = sugarDecode($key, $encodedResult);
        $resultData = unserialize($serializedResultData);
        if ($response_data && empty($resultData)) {
            $resultData = array();
            $resultData['validation'] = 'invalid validation key';
        }
    } else {
        $resultData = array();
        $resultData['versions'] = array();
    }
    if (!isset($resultData['validation'])) {
        $resultData['validation'] = 'invalid';
    }
    if ($response_data || !$sclient->getError()) {
        // This section of code is a portion of the code referred
        // to as Critical Control Software under the End User
        // License Agreement.  Neither the Company nor the Users
        // may modify any portion of the Critical Control Software.
        checkDownloadKey($resultData['validation']);
        //END REQUIRED CODE
        if (!empty($resultData['msg'])) {
            if (!empty($resultData['msg']['admin'])) {
                $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
            } else {
                $license->saveSetting('license', 'msg_admin', '');
            }
            if (!empty($resultData['msg']['all'])) {
                $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
            } else {
                $license->saveSetting('license', 'msg_all', '');
            }
        } else {
            $license->saveSetting('license', 'msg_admin', '');
            $license->saveSetting('license', 'msg_all', '');
        }
        $license->saveSetting('license', 'last_validation', 'success');
        unset($_SESSION['COULD_NOT_CONNECT']);
    } else {
        $resultData = array();
        $resultData['versions'] = array();
        $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
        $license->saveSetting('license', 'last_validation', 'no_connection');
        if (empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])) {
            $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
            $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified' => false))));
        }
        $_SESSION['COULD_NOT_CONNECT'] = TimeDate::getInstance()->nowDb();
    }
    if (!empty($resultData['versions'])) {
        $license->saveSetting('license', 'latest_versions', base64_encode(serialize($resultData['versions'])));
    } else {
        $resultData['versions'] = array();
        $license->saveSetting('license', 'latest_versions', '');
    }
    include 'sugar_version.php';
    if (sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) && compareVersions($sugar_version, $resultData['versions'][0]['version'])) {
        $resultData['versions'][0]['version'] = $sugar_version;
        $resultData['versions'][0]['description'] = "You have the latest version.";
    }
    return $resultData['versions'];
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:updater_utils.php

示例6: compareVersions

<?php

require '../lib/util.php';
$update = "%%VERSION%%";
$clientVersion = $_GET['version'];
$compVal = compareVersions($update, $clientVersion);
if ($compVal == 1) {
    print "update";
} else {
    if ($compVal == -1) {
        print "you're ahead of the curve!";
    } else {
        print "you're up-to-date";
    }
}
开发者ID:manoj-g-nair,项目名称:crowdlogger,代码行数:15,代码来源:checkForUpdate.php

示例7: array_key_exists

<?php

require '../lib/util.php';
print "{";
$crowdloggerVersion = array_key_exists('v', $_GET) ? $_GET['v'] : "2.0.1";
$first = true;
foreach (glob("*/metadata.json") as $filename) {
    $rawJSON = "";
    $f = fopen($filename, "r");
    while ($line = fgets($f)) {
        $rawJSON .= $line;
    }
    fclose($f);
    $parsedJSON = json_decode($rawJSON, true);
    $minCLVersion = array_key_exists('minCLVersion', $parsedJSON) ? $parsedJSON['minCLVersion'] : "0";
    // Check if the CLRM is okay for the given CrowdLogger version.
    if (compareVersions($crowdloggerVersion, $minCLVersion) < 0) {
        continue;
    }
    if ($first) {
        $first = false;
    } else {
        print ",";
    }
    print "\"{$parsedJSON["clrmid"]}\": {$rawJSON}";
}
print "}";
开发者ID:manoj-g-nair,项目名称:crowdlogger,代码行数:27,代码来源:clrms.php


注:本文中的compareVersions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。