/** * @see \wcf\form\IForm::validate() */ public function validate() { parent::validate(); $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, $this->fileSystemPath, $this->additionalData); // validate database Access try { $this->exporter->validateDatabaseAccess(); } catch (DatabaseException $e) { WCF::getTPL()->assign('exception', $e); throw new UserInputException('database'); } // validate selected data if (!$this->exporter->validateSelectedData($this->selectedData)) { throw new UserInputException('selectedData'); } // validate file access if (!$this->exporter->validateFileAccess()) { throw new UserInputException('fileSystemPath'); } // validate user merge mode switch ($this->userMergeMode) { case UserImporter::MERGE_MODE_EMAIL: case UserImporter::MERGE_MODE_USERNAME_OR_EMAIL: break; default: $this->userMergeMode = UserImporter::MERGE_MODE_EMAIL; } }
/** * Reads the path to the file system. */ protected function readFileSystemPath() { CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.configure.fileSystem.path')); while (true) { $this->fileSystemPath = CLIWCF::getReader()->readLine('> '); if ($this->fileSystemPath === null) { exit; } $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, $this->fileSystemPath, array()); if (!$this->exporter->validateFileAccess()) { CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.configure.fileSystem.path.error')); continue; } break; } }