Esempio n. 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');
                         Yii::app()->session['update_result'] = null;
                         Yii::app()->session['security_update'] = null;
                         $today = new DateTime("now");
                         Yii::app()->session['next_update_check'] = $today->add(new DateInterval('PT6H'));
                         // 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 = "unknown_destination_build";
     }
     return $this->_renderErrorString($error);
 }