本文整理匯總了PHP中Update::getLocalAvailableUpdates方法的典型用法代碼示例。如果您正苦於以下問題:PHP Update::getLocalAvailableUpdates方法的具體用法?PHP Update::getLocalAvailableUpdates怎麽用?PHP Update::getLocalAvailableUpdates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Update
的用法示例。
在下文中一共展示了Update::getLocalAvailableUpdates方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: view
function view()
{
$upd = new Update();
$updates = $upd->getLocalAvailableUpdates();
$remote = $upd->getApplicationUpdateInformation();
$this->set('updates', $updates);
if (MULTI_SITE == 0) {
$this->set('showDownloadBox', true);
} else {
$this->set('showDownloadBox', false);
}
if (is_object($remote) && version_compare($remote->version, APP_VERSION, '>')) {
// loop through local updates
$downloadableUpgradeAvailable = true;
foreach ($updates as $upd) {
if ($upd->getUpdateVersion() == $remote->version) {
// we have a LOCAL version ready to install that is the same, so we abort
$downloadableUpgradeAvailable = false;
$this->set('showDownloadBox', false);
break;
}
}
$this->set('downloadableUpgradeAvailable', $downloadableUpgradeAvailable);
$this->set('update', $remote);
} else {
$this->set('downloadableUpgradeAvailable', false);
}
}
示例2: getLatestAvailableVersionNumber
public function getLatestAvailableVersionNumber()
{
if (defined('MULTI_SITE') && MULTI_SITE == 1) {
$updates = Update::getLocalAvailableUpdates();
$multiSiteVersion = 0;
foreach ($updates as $up) {
if (version_compare($up->getUpdateVersion(), $multiSiteVersion, '>')) {
$multiSiteVersion = $up->getUpdateVersion();
}
}
Config::save('APP_VERSION_LATEST', $multiSiteVersion);
return $multiSiteVersion;
}
$d = Loader::helper('date');
// first, we check session
$queryWS = false;
Cache::disableCache();
$vNum = Config::get('APP_VERSION_LATEST', true);
Cache::enableCache();
if (is_object($vNum)) {
$seconds = strtotime($vNum->timestamp);
$version = $vNum->value;
if (is_object($version)) {
$versionNum = $version->version;
} else {
$versionNum = $version;
}
$diff = time() - $seconds;
if ($diff > APP_VERSION_LATEST_THRESHOLD) {
// we grab a new value from the service
$queryWS = true;
}
} else {
$queryWS = true;
}
if ($queryWS) {
Loader::library('marketplace');
$mi = Marketplace::getInstance();
if ($mi->isConnected()) {
Marketplace::checkPackageUpdates();
}
$update = Update::getLatestAvailableUpdate();
$versionNum = $update->version;
if ($versionNum) {
Config::save('APP_VERSION_LATEST', $versionNum);
if (version_compare($versionNum, APP_VERSION, '>')) {
Loader::model('system_notification');
SystemNotification::add(SystemNotification::SN_TYPE_CORE_UPDATE, t('A new version of concrete5 is now available.'), '', $update->notes, View::url('/dashboard/system/backup_restore/update'));
}
} else {
// we don't know so we're going to assume we're it
Config::save('APP_VERSION_LATEST', APP_VERSION);
}
}
return $versionNum;
}
示例3: getByVersionNumber
public static function getByVersionNumber($version)
{
$upd = new Update();
$updates = $upd->getLocalAvailableUpdates();
foreach ($updates as $up) {
if ($up->getUpdateVersion() == $version) {
return $up;
}
}
}