Esempio n. 1
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);
 }
Esempio n. 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 (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);
     }
 }