mirror of
https://github.com/anope/anope.git
synced 2026-07-10 03:03:13 +02:00
BUILD : 1.7.6 (456) BUGS : N/A NOTES : Disables UseRDB if SQL fails to init
git-svn-id: svn://svn.anope.org/anope/trunk@456 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@310 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
parent
cad9c9365d
commit
2d7e6c5e2d
+4
-1
@@ -553,7 +553,10 @@ int init(int ac, char **av)
|
||||
helpserv_init();
|
||||
|
||||
#ifdef USE_RDB
|
||||
rdb_init();
|
||||
if (!rdb_init()) {
|
||||
UseRDB = 0;
|
||||
alog("Error: Disabling UseRDB due to errors with SQL");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize proxy detection */
|
||||
|
||||
+10
-6
@@ -54,11 +54,12 @@ int db_mysql_init()
|
||||
/* If the host is not defined, assume we don't want MySQL */
|
||||
if (!MysqlHost) {
|
||||
do_mysql = 0;
|
||||
alog("MySQL has been disabled.");
|
||||
alog("MySQL: has been disabled.");
|
||||
return 0;
|
||||
} else {
|
||||
do_mysql = 1;
|
||||
alog("MySQL has been enabled.");
|
||||
alog("MySQL client version %s.",mysql_get_client_info());
|
||||
alog("MySQL: has been enabled.");
|
||||
alog("MySQL: client version %s.",mysql_get_client_info());
|
||||
}
|
||||
|
||||
/* The following configuration options are required.
|
||||
@@ -68,10 +69,13 @@ int db_mysql_init()
|
||||
if ((do_mysql) && (!MysqlName || !MysqlUser)) {
|
||||
do_mysql = 0;
|
||||
alog("MySQL Error: Set all required configuration options.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!db_mysql_open())
|
||||
if (!db_mysql_open()) {
|
||||
do_mysql = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -95,14 +99,14 @@ int db_mysql_open()
|
||||
if ((!mysql_real_connect
|
||||
(mysql, MysqlHost, MysqlUser, MysqlPass, MysqlName, MysqlPort,
|
||||
MysqlSock, 0))) {
|
||||
log_perror("Cant connect to MySQL: %s\n", mysql_error(mysql));
|
||||
log_perror("MySQL Error: Cant connect to MySQL: %s\n", mysql_error(mysql));
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if ((!mysql_real_connect
|
||||
(mysql, MysqlHost, MysqlUser, MysqlPass, MysqlName, MysqlPort,
|
||||
NULL, 0))) {
|
||||
log_perror("Cant connect to MySQL: %s\n", mysql_error(mysql));
|
||||
log_perror("MySQL Error: Cant connect to MySQL: %s\n", mysql_error(mysql));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user