Пример #1
0
 /**
  * Display step4
  * @return html 
  */
 function step4()
 {
     if (Yii::app()->request->getPost('destinationBuild')) {
         $destinationBuild = Yii::app()->request->getPost('destinationBuild');
         $access_token = $_REQUEST['access_token'];
         if (Yii::app()->request->getPost('datasupdateinfo')) {
             $updateinfos = unserialize(base64_decode(Yii::app()->request->getPost('datasupdateinfo')));
             // this is the last step - Download the zip file, unpack it and replace files accordingly
             $updateModel = new UpdateForm();
             $file = $updateModel->downloadUpdateFile($access_token, $destinationBuild);
             if ($file->result) {
                 $unzip = $updateModel->unzipUpdateFile();
                 if ($unzip->result) {
                     $remove = $updateModel->removeDeletedFiles($updateinfos);
                     if ($remove->result) {
                         // Should never bug (version.php is checked before))
                         $updateModel->updateVersion($destinationBuild);
                         $updateModel->destroyGlobalSettings();
                         $updateModel->removeTmpFile('update.zip');
                         $updateModel->removeTmpFile('comfort_updater_cookie.txt');
                         // TODO : aData should contains information about each step
                         return $this->controller->renderPartial('update/updater/steps/_final', array(), false, false);
                     } else {
                         $error = $remove->error;
                     }
                 } else {
                     $error = $unzip->error;
                 }
             } else {
                 $error = $file->error;
             }
         } else {
             $error = "no_updates_infos";
         }
     } else {
         $error = "unkown_destination_build";
     }
     return $this->_renderErrorString($error);
 }
Пример #2
0
 /**
  * This function update the updater
  * It is called from the view _updater_update.
  * The view _updater_update is called by the ComfortUpdate server during the getWelcome step if the updater version is not the minimal required one.
  * @return html the welcome message
  */
 public function updateUpdater()
 {
     if (Yii::app()->request->getPost('destinationBuild')) {
         $destinationBuild = Yii::app()->request->getPost('destinationBuild');
         $updateModel = new UpdateForm();
         $localChecks = $updateModel->getLocalChecksForUpdater();
         if ($localChecks->result) {
             $file = $updateModel->downloadUpdateUpdaterFile($destinationBuild);
             if ($file->result) {
                 $unzip = $updateModel->unzipUpdateUpdaterFile();
                 if ($unzip->result) {
                     $updateModel->removeTmpFile('update_updater.zip');
                     $updateModel->removeTmpFile('comfort_updater_cookie.txt');
                     return $this->controller->renderPartial('update/updater/steps/_updater_updated', array('destinationBuild' => $destinationBuild), false, false);
                 } else {
                     $error = $unzip->error;
                 }
             } else {
                 $error = $file->error;
             }
         } else {
             return $this->controller->renderPartial('update/updater/welcome/_error_files_update_updater', array('localChecks' => $localChecks), false, false);
         }
     }
     return $this->_renderErrorString($error);
 }
Пример #3
0
 /**
  * This function update the updater
  * It is called from the view _updater_update.
  * The view _updater_update is called by the ComfortUpdate server during the getWelcome step if the updater version is not the minimal required one.
  * @return html the welcome message
  */
 public function updateUpdater()
 {
     if (Permission::model()->hasGlobalPermission('superadmin')) {
         if (Yii::app()->request->getPost('destinationBuild')) {
             $destinationBuild = Yii::app()->request->getPost('destinationBuild');
             $updateModel = new UpdateForm();
             $localChecks = $updateModel->getLocalChecksForUpdater();
             if ($localChecks->result) {
                 $file = $updateModel->downloadUpdateUpdaterFile($destinationBuild);
                 if ($file->result) {
                     $unzip = $updateModel->unzipUpdateUpdaterFile();
                     if ($unzip->result) {
                         $updateModel->removeTmpFile('update_updater.zip');
                         $updateModel->removeTmpFile('comfort_updater_cookie.txt');
                         setGlobalSetting('updateavailable', '0');
                         setGlobalSetting('updatebuild', '');
                         setGlobalSetting('updaterversions', '');
                         Yii::app()->session['update_result'] = null;
                         Yii::app()->session['next_update_check'] = null;
                         return $this->controller->renderPartial('update/updater/steps/_updater_updated', array('destinationBuild' => $destinationBuild), false, false);
                     } else {
                         $error = $unzip->error;
                     }
                 } else {
                     $error = $file->error;
                 }
             } else {
                 return $this->controller->renderPartial('update/updater/welcome/_error_files_update_updater', array('localChecks' => $localChecks), false, false);
             }
         }
         return $this->_renderErrorString($error);
     }
 }