Jelajahi Sumber

- Added support for PostgreSQL database (commented out)

Jan Janak 17 tahun lalu
induk
melakukan
4554a1c3fd
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      etc/ser-oob.cfg

+ 4 - 1
etc/ser-oob.cfg

@@ -223,6 +223,7 @@ loadpath "/usr/lib/ser/modules"
 
 # load a SQL database for authentication, domains, user AVPs etc.
 loadmodule "mysql"
+#loadmodule "postgres"
 
 loadmodule "sl"
 loadmodule "tm"
@@ -1264,7 +1265,8 @@ onsend_route{
 
 route[ON_1MIN_TIMER] {
 	# cleanup expired location records
-	db_query("delete from location where expires<utc_timestamp()");  
+	db_query("delete from location where expires<utc_timestamp()"); # MySQL
+	#db_query("delete from location where expires<now()"); # PostgreSQL
 
 	# reload domains if domain table has been changed recently
 	# note: because global attributes are read-only and we can't
@@ -1272,6 +1274,7 @@ route[ON_1MIN_TIMER] {
 	# timestamp in 2 minute time-interval
 
 	db_query("select value from global_attrs where name='domain_data_version' and type=0 and cast(value as unsigned int) between unix_timestamp(now())-120 and unix_timestamp(now())", "reload");
+	#db_query("select value from global_attrs where name='domain_data_version' and type=0 and cast(value as integer) between date_part('epoch', now() - interval '120 seconds') and date_part('epoch', now())", "reload"); # PostgreSQL
 
 	if (@db.fetch.reload.count=="1") {
 		# domain reload only available as fifo command