コード例 #1
0
 /**
  * Performs maintenance and clean up tasks after an update.
  *
  * Called during both a manual and auto-update.
  *
  * @return null
  */
 public function actionCleanUp()
 {
     $this->requirePostRequest();
     $this->requireAjaxRequest();
     $data = craft()->request->getRequiredPost('data');
     if ($this->_isManualUpdate($data)) {
         $uid = false;
     } else {
         $uid = $data['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);
     if ($handle == 'craft' && $oldVersion && version_compare($oldVersion, craft()->getVersion(), '<')) {
         $returnUrl = UrlHelper::getUrl('whats-new');
     } else {
         $returnUrl = craft()->config->get('postCpLoginRedirect');
     }
     $this->returnJson(array('alive' => true, 'finished' => true, 'returnUrl' => $returnUrl));
 }
コード例 #2
0
 /**
  * Performs maintenance and clean up tasks after an update.
  */
 public function actionCleanUp()
 {
     $this->requirePostRequest();
     $this->requireAjaxRequest();
     $data = craft()->request->getRequiredPost('data');
     if ($this->_isManualUpdate($data)) {
         $uid = false;
     } else {
         // If it's not a manual update, make sure they have auto-update permissions.
         craft()->userSession->requirePermission('performUpdates');
         $uid = $data['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));
     if ($manifestData) {
         $oldVersion = UpdateHelper::getLocalVersionFromManifest($manifestData);
     }
     $return = craft()->updates->updateCleanUp($uid, $handle);
     if (!$return['success']) {
         $this->returnJson(array('error' => $return['message']));
     }
     if ($oldVersion && version_compare($oldVersion, '1.1', '<')) {
         $returnUrl = UrlHelper::getUrl('whats-new');
     } else {
         $returnUrl = craft()->userSession->getReturnUrl();
     }
     $this->returnJson(array('success' => true, 'finished' => true, 'returnUrl' => $returnUrl));
 }
コード例 #3
0
 /**
  * Performs maintenance and clean up tasks after an update.
  *
  * Called during both a manual and auto-update.
  *
  * @return null
  */
 public function actionCleanUp()
 {
     $this->requirePostRequest();
     $this->requireAjaxRequest();
     $data = craft()->request->getRequiredPost('data');
     if ($this->_isManualUpdate($data)) {
         $uid = false;
     } else {
         // If it's not a manual update, make sure they have auto-update permissions.
         craft()->userSession->requirePermission('performUpdates');
         if (!craft()->config->get('allowAutoUpdates')) {
             $this->returnJson(array('alive' => true, 'errorDetails' => Craft::t('Auto-updating is disabled on this system.'), 'finished' => true));
         }
         $uid = $data['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));
     if ($manifestData) {
         $oldVersion = UpdateHelper::getLocalVersionFromManifest($manifestData);
     }
     craft()->updates->updateCleanUp($uid, $handle);
     if ($oldVersion && version_compare($oldVersion, craft()->getVersion(), '<')) {
         $returnUrl = UrlHelper::getUrl('whats-new');
     } else {
         $returnUrl = craft()->userSession->getReturnUrl();
     }
     $this->returnJson(array('alive' => true, 'finished' => true, 'returnUrl' => $returnUrl));
 }
コード例 #4
0
 /**
  * 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));
 }