本文整理汇总了PHP中AppHelper::getMajorVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP AppHelper::getMajorVersion方法的具体用法?PHP AppHelper::getMajorVersion怎么用?PHP AppHelper::getMajorVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppHelper
的用法示例。
在下文中一共展示了AppHelper::getMajorVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCleanUp
/**
* Performs maintenance and clean up tasks after an update.
*
* Called during both a manual and auto-update.
*
* @return null
* @throws Exception
*/
public function actionCleanUp()
{
$this->requirePostRequest();
$this->requireAjaxRequest();
$data = craft()->request->getRequiredPost('data');
if ($this->_isManualUpdate($data)) {
$uid = false;
} else {
$uid = craft()->security->validateData($data['uid']);
if (!$uid) {
throw new Exception('Could not validate UID');
}
}
$handle = $this->_getFixedHandle($data);
$oldVersion = false;
// Grab the old version from the manifest data before we nuke it.
$manifestData = UpdateHelper::getManifestData(UpdateHelper::getUnzipFolderFromUID($uid), $handle);
if ($manifestData && $handle == 'craft') {
$oldVersion = UpdateHelper::getLocalVersionFromManifest($manifestData);
}
craft()->updates->updateCleanUp($uid, $handle);
// New major Craft CMS version?
if ($handle == 'craft' && $oldVersion && AppHelper::getMajorVersion($oldVersion) < AppHelper::getMajorVersion(craft()->getVersion())) {
$returnUrl = UrlHelper::getUrl('whats-new');
} else {
$returnUrl = craft()->config->get('postCpLoginRedirect');
}
$this->returnJson(array('alive' => true, 'finished' => true, 'returnUrl' => $returnUrl));
}