private function processUpdate()
 {
     global $_CORELANG, $_CONFIG, $_ARRAYLANG;
     $this->objTemplate->addBlockfile('CONTENT', 'process', 'process.html');
     if (($return = $this->_loadUpdateLanguage()) !== true) {
         $this->objTemplate->setVariable('UPDATE_ERROR_MSG', $return);
         $this->objTemplate->parse('updateProcessError');
     } elseif (($arrVersions = $this->getAvailabeVersions()) === false || !@(include_once UPDATE_UPDATES . '/' . $_SESSION['contrexx_update']['version'] . '/' . $arrVersions[$_SESSION['contrexx_update']['version']]['script'])) {
         $this->objTemplate->setVariable('UPDATE_ERROR_MSG', $_CORELANG['TXT_UPDATE_UNABLE_TO_START']);
         $this->objTemplate->parse('updateProcessError');
     } else {
         if (!$this->_isNewerVersion($_CONFIG['coreCmsVersion'], $_SESSION['contrexx_update']['version'])) {
             $result = true;
         } else {
             if (!empty($_POST['execution_time'])) {
                 $_SESSION['contrexx_update']['max_execution_time'] = intval($_POST['execution_time']);
                 if (intval($_POST['execution_time']) < 20) {
                     setUpdateMsg('<div class="message-warning">' . $_CORELANG['TXT_UPDATE_EXECUTION_TIME'] . '</div>', 'msg');
                     setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
                     $result = false;
                 } else {
                     die('{"time": ' . intval($_POST['execution_time']) . '}');
                 }
             } else {
                 try {
                     if (!activateDebugging()) {
                         throw new \Exception("The debugging file couldn't be created.");
                     }
                     $result = true;
                 } catch (\Exception $e) {
                     setUpdateMsg($_CORELANG['TXT_UPDATE_DBG_FILE'], 'msg');
                     setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="skipDebugMsg" id="skipDebugMsg" value="skipDebugMsg" />', 'button');
                     if (empty($_POST['skipDebugMsg'])) {
                         $result = false;
                     }
                 }
                 if ($result !== false) {
                     DBG::msg('-------------------------------------------------------------');
                     DBG::msg('CLOUDREXX UPDATE - NEW REQUEST');
                     DBG::msg('Date: ' . date('d.m.Y H:i:s'));
                     DBG::msg('Get-Params:');
                     DBG::dump($_GET);
                     DBG::msg('User: '******'contrexx_update']['username']);
                     DBG::msg('-------------------------------------------------------------');
                     $result = executeContrexxUpdate();
                 }
             }
         }
         if ($result !== true) {
             if (!empty($this->arrStatusMsg['error'])) {
                 $this->objTemplate->setVariable('UPDATE_ERROR_MSG', implode('<br />', $this->arrStatusMsg['error']));
                 $this->objTemplate->parse('updateProcessError');
             }
             if (empty($this->arrStatusMsg['title'])) {
                 $this->arrStatusMsg['title'] = 'Update Fehler';
             }
             if (empty($this->arrStatusMsg['button'])) {
                 $this->arrStatusMsg['button'] = '<input type="submit" value="' . $_CORELANG['TXT_UPDATE_TRY_AGAIN'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />';
             }
             if (!empty($this->arrStatusMsg['dialog']) && empty($this->arrStatusMsg['error'])) {
                 $this->objTemplate->hideBlock('processStatus');
                 $dialogContent = implode('<br />', $this->arrStatusMsg['msg']);
                 if (!$this->ajax) {
                     $dialogContent = str_replace(array('\'', "\r\n"), array('\\\'', ''), $dialogContent);
                 }
                 $this->objTemplate->setVariable('PROCESS_DIALOG_CONTENT', $dialogContent);
                 if ($this->ajax) {
                     $this->html['dialog'] = $this->arrStatusMsg['dialog'];
                     $this->objTemplate->parse('ajaxDialogContent');
                 } else {
                     $this->objTemplate->parse('dialogContent');
                 }
             } else {
                 if (!empty($this->arrStatusMsg['timeout']) && empty($this->arrStatusMsg['error'])) {
                     $this->html['timeout'] = $this->arrStatusMsg['timeout'];
                 } else {
                     $this->objTemplate->hideBlock('dialogContent');
                     $this->objTemplate->hideBlock('ajaxDialogContent');
                     $this->objTemplate->setVariable(array('UPDATE_PROCESS_TITLE' => $_CORELANG['TXT_UPDATE_UPDATE_PROCESS'], 'UPDATE_STATUS_TITLE' => $this->arrStatusMsg['title'], 'UPDATE_STATUS' => str_replace('[[SQL_INFO_TITLE]]', $this->arrStatusMsg['title'], implode('<br />', $this->arrStatusMsg['msg']))));
                     $this->setNavigation($this->arrStatusMsg['button']);
                 }
             }
         } else {
             $this->objTemplate->hideBlock('dialogContent');
             $this->objTemplate->hideBlock('ajaxDialogContent');
             $this->objTemplate->hideBlock('processStatus');
             $urlFrontend = ASCMS_PATH_OFFSET !== '' ? ASCMS_PATH_OFFSET : '/';
             if (!empty($_SESSION['contrexx_update']['modified_files']) && count($_SESSION['contrexx_update']['modified_files'])) {
                 foreach ($_SESSION['contrexx_update']['modified_files'] as $arrFile) {
                     $this->objTemplate->setVariable(array('BACKUP_FILE_SRC' => $arrFile['src'], 'BACKUP_FILE_DST' => $arrFile['dst']));
                     $this->objTemplate->parse('backed_file');
                 }
                 $this->objTemplate->parse('backed_files');
             } else {
                 $this->objTemplate->hideblock('backed_files');
             }
             if (!empty($_SESSION['contrexx_update']['modified_cmds']) && count($_SESSION['contrexx_update']['modified_cmds'])) {
                 foreach ($_SESSION['contrexx_update']['modified_cmds'] as $arrCmds) {
                     $this->objTemplate->setVariable(array('CHANGED_CMD_PAGE_TITLE' => $arrCmds['pageTitle'], 'CHANGED_CMD_ORIG_CMD' => $arrCmds['origCmd'], 'CHANGED_CMD_NEW_CMD' => $arrCmds['newCmd']));
                     $this->objTemplate->parse('changed_cmd');
                 }
                 $this->objTemplate->parse('changed_cmds');
             } else {
                 $this->objTemplate->hideblock('changed_cmds');
             }
             $this->objTemplate->setVariable(array('TXT_UPDATE_UPDATE_FINISHED' => $_CORELANG['TXT_UPDATE_UPDATE_FINISHED'], 'URL_FRONTEND' => $urlFrontend, 'URL_BACKEND' => ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH, 'UPDATE_VERSION_INSTALLED' => $this->getLiteralRepresentationOfVersion($_SESSION['contrexx_update']['version']), 'UPDATE_VERSION_NUMBER' => $_SESSION['contrexx_update']['version']));
             $this->objTemplate->parse('finish');
             $_SESSION['contrexx_update']['step'] = 0;
             $_SESSION['contrexx_update']['update'] = array();
         }
     }
     $this->objTemplate->parse('process');
     if ($this->ajax) {
         $this->html['content'] = $this->objTemplate->get('process');
     }
 }
Beispiel #2
0
// Initialize base system
$objInit = new InitCMS('update', \Env::get('em'));
Env::set('init', $objInit);
JS::activate('cx');
JS::activate('jquery-tools');
JS::registerJS('lib/contrexxUpdate.php');
JS::registerJS('lib/javascript/html2dom.js');
// Debugging
try {
    // load file classes
    require_once dirname(__FILE__) . '/lib/FRAMEWORK/FileSystem/FileInterface.interface.php';
    require_once dirname(__FILE__) . '/lib/FRAMEWORK/FileSystem/FileSystem.class.php';
    require_once dirname(__FILE__) . '/lib/FRAMEWORK/FileSystem/FileSystemFile.class.php';
    require_once dirname(__FILE__) . '/lib/FRAMEWORK/FileSystem/FTPFile.class.php';
    require_once dirname(__FILE__) . '/lib/FRAMEWORK/FileSystem/File.class.php';
    activateDebugging();
} catch (\Exception $e) {
    // don't handle this exception here because we can't print a nice error message
}
require_once UPDATE_CORE . '/cache/cache.class.php';
global $objCache;
$objCache = new \Cx\Core_Modules\Cache\Controller\Cache();
// Start update
$objUpdate = new ContrexxUpdate();
// $_CORELANG has been initialized by the constructor of ContrexxUpdate()
// add language variables of core (will be used by FWUser)
$_CORELANG = array_merge($objInit->loadLanguageData('core'), $_CORELANG);
$output = $objUpdate->getPage();
JS::findJavascripts($output);
$output = str_replace('javascript_inserting_here', JS::getCode(), $output);
die($output);