Exemplo n.º 1
0
 /**
  * DB info entry page
  *
  * @return string
  */
 public function dbInfo()
 {
     $oView = $this->getView();
     $oSession = $this->getInstance("oxSetupSession");
     $iEula = $this->getInstance("oxSetupUtils")->getRequestVar("iEula", "post");
     $iEula = (int) ($iEula ? $iEula : $oSession->getSessionParam("eula"));
     if (!$iEula) {
         $oSetup = $this->getInstance("oxSetup");
         $oSetup->setNextStep($oSetup->getStep("STEP_WELCOME"));
         $oView->setMessage($this->getInstance("oxSetupLang")->getText("ERROR_SETUP_CANCELLED"));
         return "licenseerror.php";
     }
     $oView->setTitle('STEP_3_TITLE');
     $aDB = $oSession->getSessionParam('aDB');
     if (!isset($aDB)) {
         // default values
         $aDB['dbHost'] = "localhost";
         $aDB['dbUser'] = "";
         $aDB['dbPwd'] = "";
         $aDB['dbName'] = "";
         $aDB['dbiDemoData'] = 1;
     }
     $oView->setViewParam("aDB", $aDB);
     // mb string library info
     $oSysReq = getSystemReqCheck();
     $oView->setViewParam("blMbStringOn", $oSysReq->getModuleInfo('mb_string'));
     $oView->setViewParam("blUnicodeSupport", $oSysReq->getModuleInfo('unicode_support'));
     return "dbinfo.php";
 }
Exemplo n.º 2
0
 /**
  * Returns or prints url for info about missing web service configuration
  *
  * @param string $sIdent  module identifier
  * @param bool   $blPrint prints result if TRUE
  *
  * @return mixed
  */
 public function getReqInfoUrl($sIdent, $blPrint = true)
 {
     $oSysReq = getSystemReqCheck();
     $sUrl = $oSysReq->getReqInfoUrl($sIdent);
     return $blPrint ? print $sUrl : $sUrl;
 }
Exemplo n.º 3
0
 /**
  * Opens database connection and returns connection resource object
  *
  * @param array $aParams database connection parameters array
  *
  * @throws Exception exception is thrown if connection failed or was unable to select database
  *
  * @return object
  */
 public function openDatabase($aParams)
 {
     $aParams = is_array($aParams) && count($aParams) ? $aParams : $this->getInstance("Session")->getSessionParam('aDB');
     if ($this->_oConn === null) {
         // ok open DB
         try {
             $dsn = sprintf('mysql:host=%s', $aParams['dbHost']);
             $this->_oConn = new PDO($dsn, $aParams['dbUser'], $aParams['dbPwd'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
             $this->_oConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
             $this->_oConn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
         } catch (PDOException $e) {
             /** @var Setup $oSetup */
             $oSetup = $this->getInstance("Setup");
             $oSetup->setNextStep($oSetup->getStep('STEP_DB_INFO'));
             throw new Exception($this->getInstance("Language")->getText('ERROR_DB_CONNECT') . " - " . $e->getMessage(), Database::ERROR_DB_CONNECT, $e);
         }
         // testing version
         $oSysReq = getSystemReqCheck();
         if (!$oSysReq->checkMysqlVersion($this->getDatabaseVersion())) {
             throw new Exception($this->getInstance("Language")->getText('ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS'), Database::ERROR_MYSQL_VERSION_DOES_NOT_FIT_REQUIREMENTS);
         }
         try {
             $this->_oConn->exec("USE `{$aParams['dbName']}`");
         } catch (Exception $e) {
             throw new Exception($this->getInstance("Language")->getText('ERROR_COULD_NOT_CREATE_DB') . " - " . $e->getMessage(), Database::ERROR_COULD_NOT_CREATE_DB, $e);
         }
     }
     return $this->_oConn;
 }