示例#1
0
文件: Import.php 项目: Sywooch/forums
 public function actionComplete()
 {
     if ($this->_request->isPost()) {
         $input = $this->_input->filter(array('archive' => XenForo_Input::UINT, 'table' => XenForo_Input::STRING));
         if ($input['archive'] && $input['table']) {
             if (!$this->_getImportModel()->archiveImportLog($input['table'], $error)) {
                 return $this->responseError($error);
             }
         }
         $session = new XenForo_ImportSession();
         $importerKey = $session->getImporterKey();
         $session->delete();
         XenForo_Application::defer('Atomic', array('simple' => array('User', 'Thread', 'Poll', 'Forum')), 'importRebuild', true);
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('import/complete', false, array('confirm' => $importerKey)));
     } else {
         if ($importerKey = $this->_input->filterSingle('confirm', XenForo_Input::STRING)) {
             $importer = $this->_getImportModel()->getImporter($importerKey);
             $messages = $importer ? $importer->getImportCompleteMessages() : array();
             return $this->responseView('XenForo_ViewAdmin_Import_Complete', 'import_complete', array('messages' => $messages));
         } else {
             $session = new XenForo_ImportSession();
             $config = $session->getConfig();
             if (!$session->getImporterKey()) {
                 return $this->responseView('XenForo_ViewAdmin_Import_Complete', 'import_complete', array('messages' => array()));
             }
             $viewParams = array('importerName' => $this->_getImportModel()->getImporterName($session->getImporterKey()), 'logSuffix' => $config['db']['dbname']);
             return $this->responseView('XenForo_ViewAdmin_Import_CompleteConfirm', 'import_complete_confirm', $viewParams);
         }
     }
 }
示例#2
0
 public function actionComplete()
 {
     if ($this->_request->isPost()) {
         $input = $this->_input->filter(array('archive' => XenForo_Input::UINT, 'table' => XenForo_Input::STRING));
         if ($input['archive'] && $input['table']) {
             if (!$this->_getImportModel()->archiveImportLog($input['table'], $error)) {
                 return $this->responseError($error);
             }
         }
         $session = new XenForo_ImportSession();
         $importerKey = $session->getImporterKey();
         $session->delete();
         $caches = array('User', 'Thread', 'Poll', 'Forum');
         return XenForo_CacheRebuilder_Abstract::getRebuilderResponse($this, $caches, XenForo_Link::buildAdminLink('import/complete', false, array('confirm' => $importerKey)));
     } else {
         if ($importerKey = $this->_input->filterSingle('confirm', XenForo_Input::STRING)) {
             $messages = $this->_getImportModel()->getImporter($importerKey)->getImportCompleteMessages();
             return $this->responseView('XenForo_ViewAdmin_Import_Complete', 'import_complete', array('messages' => $messages));
         } else {
             $session = new XenForo_ImportSession();
             $config = $session->getConfig();
             $importer = $this->_getImportModel()->getImporter($session->getImporterKey());
             $viewParams = array('importerName' => $importer->getName(), 'logSuffix' => $config['db']['dbname']);
             return $this->responseView('XenForo_ViewAdmin_Import_CompleteConfirm', 'import_complete_confirm', $viewParams);
         }
     }
 }