芝麻web文件管理V1.00
编辑当前文件:/home/asmplong/www/ancien-site-2019/site/libraries/joomla/log/loggers/database.php
options['db_object']) && empty($this->options['db_driver'])) { $this->dbo = JFactory::getDBO(); $this->driver = JFactory::getConfig()->get('dbtype'); $this->host = JFactory::getConfig()->get('host'); $this->user = JFactory::getConfig()->get('user'); $this->password = JFactory::getConfig()->get('password'); $this->database = JFactory::getConfig()->get('db'); $this->prefix = JFactory::getConfig()->get('dbprefix'); } // We need to get the database connection settings from the configuration options. else { $this->driver = (empty($this->options['db_driver'])) ? 'mysql' : $this->options['db_driver']; $this->host = (empty($this->options['db_host'])) ? '127.0.0.1' : $this->options['db_host']; $this->user = (empty($this->options['db_user'])) ? 'root' : $this->options['db_user']; $this->password = (empty($this->options['db_pass'])) ? '' : $this->options['db_pass']; $this->database = (empty($this->options['db_database'])) ? 'logging' : $this->options['db_database']; $this->prefix = (empty($this->options['db_prefix'])) ? 'jos_' : $this->options['db_prefix']; } // The table name is independent of how we arrived at the connection object. $this->table = (empty($this->options['db_table'])) ? '#__log_entries' : $this->options['db_table']; } /** * Method to add an entry to the log. * * @param JLogEntry $entry The log entry object to add to the log. * * @return void * * @since 11.1 */ public function addEntry(JLogEntry $entry) { // Connect to the database if not connected. if (empty($this->dbo)) { $this->connect(); } // Convert the date. $entry->date = $entry->date->toMySQL(); $this->dbo->insertObject($this->table, $entry); } /** * Method to connect to the database server based on object properties. * * @return void * * @since 11.1 * @throws LogException */ protected function connect() { // Build the configuration object to use for JDatabase. $options = array( 'driver' => $this->driver, 'host' => $this->host, 'user' => $this->user, 'password' => $this->password, 'database' => $this->database, 'prefix' => $this->prefix ); try { $db = JDatabase::getInstance($options); if (JError::isError($db)) { throw new LogException('Database Error: ' . (string) $db); } if ($db->getErrorNum() > 0) { throw new LogException(JText::sprintf('JLIB_UTIL_ERROR_CONNECT_DATABASE', $db->getErrorNum(), $db->getErrorMsg())); } // Assign the database connector to the class. $this->dbo = $db; } catch (DatabaseException $e) { throw new LogException($e->getMessage()); } } }