/** * Abort function */ private function pageSyncAbort() { if ($this->booAbort == false) { // Set content back to normale mode $this->booError = false; $this->strError = ""; $this->booAbort = true; $this->booRefresh = false; // Reset Session $this->resetStepPoolByID(array(1, 2, 3, 4, 5, 6)); try { $this->objSyncCtoCommunicationClient->stopConnection(); } catch (Exception $exc) { // Nothing to do } try { $this->objSyncCtoCommunicationClient->referrerEnable(); } catch (Exception $exc) { // Nothing to do } // Set stats SyncCtoStats::getInstance()->addAbortStat(time(), $this->intStep); // Set stepe $this->intStep = 99; // Set last to skipped $this->objData->setState(SyncCtoEnum::WORK_SKIPPED); $this->objData->setHtml(""); // Set Abort information $this->objData->setStep(99); $this->objData->setTitle($GLOBALS['TL_LANG']['MSC']['abort']); $this->objData->setDescription($GLOBALS['TL_LANG']['tl_syncCto_sync']['abort']); $this->objData->setState(SyncCtoEnum::WORK_ERROR); } }
protected function pageFileRestorePage() { // Init | Set Step to 1 if ($this->intStep == 0) { // Init content $this->booError = false; $this->booAbort = false; $this->booFinished = false; $this->strError = ""; $this->booRefresh = true; $this->strUrl = "contao/main.php?do=syncCto_backups&table=tl_syncCto_restore_file&act=start"; $this->strGoBack = \Environment::get('base') . "contao/main.php?do=syncCto_backups&table=tl_syncCto_restore_file"; $this->strHeadline = $GLOBALS['TL_LANG']['tl_syncCto_restore_file']['edit']; $this->strInformation = ""; $this->intStep = 1; $this->floStart = microtime(true); $this->objData = new ContentData(array(), $this->intStep); // Reset some Sessions $this->resetStepPool(); } // Load step pool $this->loadStepPool(); // Set content back to normale mode $this->booRefresh = true; $this->objData->setStep(1); $this->objData->setState(SyncCtoEnum::WORK_WORK); $this->objData->setHtml(""); try { switch ($this->intStep) { case 1: $this->objData->setTitle($GLOBALS['TL_LANG']['MSC']['step'] . " %s"); $this->objData->setDescription($GLOBALS['TL_LANG']['tl_syncCto_restore_file']['step1']); $this->objData->setState(SyncCtoEnum::WORK_WORK); $this->intStep++; break; case 2: try { $mixResponse = $this->objSyncCtoFiles->runRestore($this->arrBackupSettings['syncCto_restoreFile']); if ($mixResponse !== true) { $strHTML = $GLOBALS['TL_LANG']['ERR']['cant_extract_file']; $strHTML .= "<br />"; $strHTML .= "<ul>"; foreach ($mixResponse as $value) { $strHTML .= "<li>" . $value . "</li>"; } $strHTML .= "</ul>"; $this->booError = true; $this->strError = $strHTML; $this->objData->setStep(1); $this->objData->setDescription($GLOBALS['TL_LANG']['ERR']['cant_extract_file']); break; } $this->intStep++; break; } catch (Exception $exc) { $this->booError = true; $this->strError = $exc->getMessage(); $this->objData->setStep(1); $this->objData->setState(SyncCtoEnum::WORK_ERROR); break; } case 3: $objDate = new Date(); $this->booFinished = true; $this->booRefresh = false; $this->objData->setStep(1); $this->objData->setState(SyncCtoEnum::WORK_OK); $this->objData->setStep(2); $this->objData->setTitle($GLOBALS['TL_LANG']['MSC']['complete']); $this->objData->setDescription(vsprintf($GLOBALS['TL_LANG']['tl_syncCto_restore_file']['complete'], array($this->arrBackupSettings['backup_file'], $objDate->time, $objDate->date))); $this->objData->setState(SyncCtoEnum::WORK_OK); break; } } catch (Exception $exc) { $objErrTemplate = new BackendTemplate('be_syncCto_error'); $objErrTemplate->strErrorMsg = $exc->getMessage(); $this->booRefresh = false; $this->objData->setState(SyncCtoEnum::WORK_ERROR); $this->objData->setHtml($objErrTemplate->parse()); } }