Beispiel #1
0
 /**
  * Load the config from the constructor.
  *
  * @param string         $hostname
  * @param string         $username
  * @param string         $password
  * @param string         $database
  * @param int            $port
  * @param string         $charset
  * @param boolean|string $exit_on_error use a empty string "" or false to disable it
  * @param boolean|string $echo_on_error use a empty string "" or false to disable it
  * @param string         $logger_class_name
  * @param string         $logger_level
  * @param boolean|string $session_to_db use a empty string "" or false to disable it
  *
  * @return bool
  */
 private function _loadConfig($hostname, $username, $password, $database, $port, $charset, $exit_on_error, $echo_on_error, $logger_class_name, $logger_level, $session_to_db)
 {
     $this->hostname = (string) $hostname;
     $this->username = (string) $username;
     $this->password = (string) $password;
     $this->database = (string) $database;
     if ($charset) {
         $this->charset = (string) $charset;
     }
     if ($port) {
         $this->port = (int) $port;
     } else {
         /** @noinspection PhpUsageOfSilenceOperatorInspection */
         $this->port = @ini_get('mysqli.default_port');
     }
     if (!$this->socket) {
         /** @noinspection PhpUsageOfSilenceOperatorInspection */
         $this->socket = @ini_get('mysqli.default_socket');
     }
     if ($exit_on_error === true || $exit_on_error === false) {
         $this->_debug->setExitOnError($exit_on_error);
     }
     if ($echo_on_error === true || $echo_on_error === false) {
         $this->_debug->setEchoOnError($echo_on_error);
     }
     $this->_debug->setLoggerClassName($logger_class_name);
     $this->_debug->setLoggerLevel($logger_level);
     $this->session_to_db = (bool) $session_to_db;
     return $this->showConfigError();
 }