From d806ae0da0811f26d23fd241ede8840d09cf74e4 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 30 Jun 2009 17:15:09 +0000 Subject: Rename res_mysql.conf to res_config_mysql.conf, make module support both git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@204422 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- addons/res_config_mysql.c | 8 +++++++- configs/res_config_mysql.conf.sample | 40 ++++++++++++++++++++++++++++++++++++ configs/res_mysql.conf.sample | 40 ------------------------------------ 3 files changed, 47 insertions(+), 41 deletions(-) create mode 100644 configs/res_config_mysql.conf.sample delete mode 100644 configs/res_mysql.conf.sample diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c index 2cd1fa4f4..76a741695 100644 --- a/addons/res_config_mysql.c +++ b/addons/res_config_mysql.c @@ -47,7 +47,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/utils.h" #include "asterisk/threadstorage.h" -#define RES_CONFIG_MYSQL_CONF "res_mysql.conf" +#define RES_CONFIG_MYSQL_CONF "res_config_mysql.conf" +#define RES_CONFIG_MYSQL_CONF_OLD "res_mysql.conf" #define READHANDLE 0 #define WRITEHANDLE 1 @@ -1413,6 +1414,11 @@ static int parse_config(int reload) struct mysql_conn *cur; if ((config = ast_config_load(RES_CONFIG_MYSQL_CONF, config_flags)) == CONFIG_STATUS_FILEMISSING) { + /* Support old config file name */ + config = ast_config_load(RES_CONFIG_MYSQL_CONF_OLD, config_flags); + } + + if (config == CONFIG_STATUS_FILEMISSING) { return 0; } else if (config == CONFIG_STATUS_FILEUNCHANGED) { return 0; diff --git a/configs/res_config_mysql.conf.sample b/configs/res_config_mysql.conf.sample new file mode 100644 index 000000000..dfbbf49a8 --- /dev/null +++ b/configs/res_config_mysql.conf.sample @@ -0,0 +1,40 @@ +; +; Sample configuration for res_config_mysql.c +; +; The value of dbhost may be either a hostname or an IP address. +; If dbhost is commented out or the string "localhost", a connection +; to the local host is assumed and dbsock is used instead of TCP/IP +; to connect to the server. +; +; Multiple database contexts may be configured, with the caveat that +; all context names should be unique and must not contain the slash ('/') +; character. If you wish to separate reads from writes in your database +; configuration, you specify the database (NOT HERE, in other files) +; separated by a slash, read database first. If your database +; specification does not contain a slash, the implication is that reads +; and writes should be performed to the same database. +; +; For example, in extconfig.conf, you could specify a line like: +; sippeers => mysql,readhost.asterisk/writehost.asterisk,sipfriends +; and then define the contexts [readhost.asterisk] and [writehost.asterisk] +; below. +; +; The requirements parameter is available only in Asterisk 1.6.1 and +; later and must be present in all contexts. It specifies the behavior +; when a column name is required by the system. The default behavior is +; "warn" and simply sends a warning to the logger that the column does +; not exist (or is of the wrong type or precision). The other two +; possibilities are "createclose", which adds the column with the right +; type and length, and "createchar", which adds the column as a char +; type, with the appropriate length to accept the data. Note that with +; the MySQL driver, both "createclose" and "createchar" will, on occasion, +; widen a table column width to meet the requirements specified. +; +[general] +;dbhost = 127.0.0.1 +;dbname = asterisk +;dbuser = myuser +;dbpass = mypass +;dbport = 3306 +;dbsock = /tmp/mysql.sock +;requirements=warn ; or createclose or createchar diff --git a/configs/res_mysql.conf.sample b/configs/res_mysql.conf.sample deleted file mode 100644 index dfbbf49a8..000000000 --- a/configs/res_mysql.conf.sample +++ /dev/null @@ -1,40 +0,0 @@ -; -; Sample configuration for res_config_mysql.c -; -; The value of dbhost may be either a hostname or an IP address. -; If dbhost is commented out or the string "localhost", a connection -; to the local host is assumed and dbsock is used instead of TCP/IP -; to connect to the server. -; -; Multiple database contexts may be configured, with the caveat that -; all context names should be unique and must not contain the slash ('/') -; character. If you wish to separate reads from writes in your database -; configuration, you specify the database (NOT HERE, in other files) -; separated by a slash, read database first. If your database -; specification does not contain a slash, the implication is that reads -; and writes should be performed to the same database. -; -; For example, in extconfig.conf, you could specify a line like: -; sippeers => mysql,readhost.asterisk/writehost.asterisk,sipfriends -; and then define the contexts [readhost.asterisk] and [writehost.asterisk] -; below. -; -; The requirements parameter is available only in Asterisk 1.6.1 and -; later and must be present in all contexts. It specifies the behavior -; when a column name is required by the system. The default behavior is -; "warn" and simply sends a warning to the logger that the column does -; not exist (or is of the wrong type or precision). The other two -; possibilities are "createclose", which adds the column with the right -; type and length, and "createchar", which adds the column as a char -; type, with the appropriate length to accept the data. Note that with -; the MySQL driver, both "createclose" and "createchar" will, on occasion, -; widen a table column width to meet the requirements specified. -; -[general] -;dbhost = 127.0.0.1 -;dbname = asterisk -;dbuser = myuser -;dbpass = mypass -;dbport = 3306 -;dbsock = /tmp/mysql.sock -;requirements=warn ; or createclose or createchar -- cgit v1.2.3