本文整理汇总了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;
}
}
}