本文整理匯總了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));
}