* The database connection string.
*/
public static function init($dsn) {
+ Civi::$statics[__CLASS__]['init'] = 1;
$options = &PEAR::getStaticProperty('DB_DataObject', 'options');
$options['database'] = $dsn;
if (defined('CIVICRM_DAO_DEBUG')) {
if (CRM_Utils_Constant::value('CIVICRM_MYSQL_STRICT', CRM_Utils_System::isDevelopment())) {
CRM_Core_DAO::executeQuery('SET SESSION sql_mode = STRICT_TRANS_TABLES');
}
+ CRM_Core_DAO::executeQuery('SET NAMES utf8');
}
/**
*/
public function initialize() {
$this->_connect();
- $this->query("SET NAMES utf8");
+ if (empty(Civi::$statics[__CLASS__]['init'])) {
+ // CRM_Core_DAO::init() must be called before CRM_Core_DAO->initialize().
+ // This occurs very early in bootstrap - error handlers may not be wired up.
+ echo "Inconsistent system initialization sequence. Premature access of (" . get_class($this) . ")";
+ CRM_Utils_System::civiExit();
+ }
}
/**
}
$file_log->close();
- if ($config->userFrameworkLogging) {
+ if (!empty($config->userFrameworkLogging)) {
// should call $config->userSystem->logger($message) here - but I got a situation where userSystem was not an object - not sure why
if ($config->userSystem->is_drupal and function_exists('watchdog')) {
watchdog('civicrm', '%message', array('%message' => $message), WATCHDOG_DEBUG);
);
$runtime->initialize($loadFromDB);
- if ($loadFromDB && $runtime->dsn) {
- \CRM_Core_DAO::init($runtime->dsn);
- }
-
$bootServices['paths'] = array(
'class' => 'Civi\Core\Paths',
'obj' => new \Civi\Core\Paths(),
);
if ($loadFromDB && $runtime->dsn) {
+ \CRM_Core_DAO::init($runtime->dsn);
\CRM_Utils_Hook::singleton(TRUE);
\CRM_Extension_System::singleton(TRUE);