*
 */
global $installing;
$installing = true;
require_once '../../init.php';
require_once MAX_PATH . '/lib/OA/Upgrade/Upgrade.php';
require_once MAX_PATH . '/lib/OA/Upgrade/Login.php';
require_once MAX_PATH . '/lib/OX/Upgrade/Util/Job.php';
// No upgrade file? No installer!
if (!file_exists(MAX_PATH . '/var/UPGRADE')) {
    header("Location: index.php");
    exit;
}
$aErrors = array();
$result = array('name' => @$_REQUEST['task'], 'status' => 'Invalid Request', 'errors' => &$aErrors, 'type' => 'task');
if (OA_Upgrade_Login::checkLogin(false)) {
    if (validRequest($result)) {
        $oUpgrader = new OA_Upgrade();
        $aResponse = $oUpgrader->runPostUpgradeTask($_REQUEST['task']);
        $result['errors'] = $aResponse['errors'];
        if (count($result['errors']) > 0) {
            $result['status'] = 'Failed';
        } else {
            $result['status'] = 'OK';
        }
    }
} else {
    OX_Upgrade_Util_Job::logError($result, 'Permissions error');
    $result['status'] = 'Permissions error';
}
// Save job results in session
 /**
  * Attempts to set the given step as current. Before doing that, checks
  * if current step  can be reached, ie.
  * - if it is a valid wizard step
  * - if all previous steps have been marked as reached.
  *
  * If step is not a valid step it will redirect to first wizard step.
  *
  * If step is valid, but is not reachable yet, it will redirect to
  * first unreached step.
  *
  * @param OX_Admin_UI_Install_Wizard $oWizard
  */
 protected function setCurrentStepIfReachable($oWizard, $stepId)
 {
     //check if given step is valid, if not, direct user to index
     if (!$oWizard->isStep($stepId)) {
         $this->redirect($oWizard->getFirstStep());
     }
     $oWizard->setCurrentStep($stepId);
     $reachable = $oWizard->checkStepReachable();
     //reachable is fine, check if not secured
     if ($reachable) {
         $aMeta = $oWizard->getStepMeta();
         if ($aMeta['secured'] == true && !OA_Upgrade_Login::checkLogin()) {
             $this->redirect('login');
         }
         return true;
     } else {
         //if step is not reachable check the last one marked as completed
         //and redirect user to the next one
         $lastCompleted = $oWizard->getLastCompletedStep();
         if ($lastCompleted != null) {
             $forwardStep = $oWizard->getNextStep($lastCompleted);
         }
         if ($forwardStep == null) {
             $forwardStep = $oWizard->getFirstStep();
         }
         $this->redirect($forwardStep);
     }
 }
示例#3
0
 if (array_key_exists('btn_post', $_POST)) {
     if (!OA_Upgrade_Login::checkLogin()) {
         $message = $strUsernameOrPasswordWrong;
         $action = OA_UPGRADE_LOGIN;
     } else {
         @unlink(MAX_PATH . '/var/plugins/recover/enabled.log');
         $result = $oUpgrader->executePostUpgradeTasks();
         if (is_array($result)) {
             $aPostTasks = $result;
         }
         $message = $strPostUpgradeTasks;
         $action = OA_UPGRADE_POST;
     }
 } else {
     if (array_key_exists('btn_finish', $_POST)) {
         if (!OA_Upgrade_Login::checkLogin()) {
             $message = $strUsernameOrPasswordWrong;
             $action = OA_UPGRADE_LOGIN;
         } else {
             if ($_COOKIE['oat'] == OA_UPGRADE_UPGRADE) {
                 $message = $strUpgradeComplete;
             } else {
                 $message = $strInstallComplete;
             }
         }
         $action = OA_UPGRADE_FINISH;
     } else {
         if (array_key_exists('dirPage', $_POST) && !empty($_POST['dirPage'])) {
             $action = $_POST['dirPage'];
             if ($_POST['dirPage'] == OA_UPGRADE_SYSCHECK) {
                 $aSysInfo = $oUpgrader->checkEnvironment();