aboutsummaryrefslogtreecommitdiff
path: root/www/mod_log_sql2-dtc
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@FreeBSD.org>2006-11-20 06:13:45 +0000
committerMarc G. Fournier <scrappy@FreeBSD.org>2006-11-20 06:13:45 +0000
commit15e3e326f48b83c188937e888428ed4d4692c8b6 (patch)
tree2f65451f6967a2ffb68645d493d0013019ed20bf /www/mod_log_sql2-dtc
parentd830a9266bc5bb3fb719f02a0c2288f58d2606b9 (diff)
downloadports-15e3e326f48b83c188937e888428ed4d4692c8b6.tar.gz
ports-15e3e326f48b83c188937e888428ed4d4692c8b6.zip
Notes
Diffstat (limited to 'www/mod_log_sql2-dtc')
-rw-r--r--www/mod_log_sql2-dtc/Makefile44
-rw-r--r--www/mod_log_sql2-dtc/distinfo3
-rw-r--r--www/mod_log_sql2-dtc/files/patch-functions13.h11
-rw-r--r--www/mod_log_sql2-dtc/files/patch-mod_log_sql.c110
-rw-r--r--www/mod_log_sql2-dtc/files/patch-mod_log_sql.h12
-rw-r--r--www/mod_log_sql2-dtc/pkg-descr4
-rw-r--r--www/mod_log_sql2-dtc/pkg-plist5
7 files changed, 189 insertions, 0 deletions
diff --git a/www/mod_log_sql2-dtc/Makefile b/www/mod_log_sql2-dtc/Makefile
new file mode 100644
index 000000000000..b0f5aaca7989
--- /dev/null
+++ b/www/mod_log_sql2-dtc/Makefile
@@ -0,0 +1,44 @@
+# New ports collection makefile for: mod_log_sql2-dtc
+# Date created: 2006/11/20
+# Whom: Marc G. Fournier <scrappy@freebsd.org>
+#
+# $FreeBSD$
+
+PORTNAME= mod_log_sql
+PORTVERSION= 1.100
+CATEGORIES= www databases
+MASTER_SITES= http://www.outoforder.cc/downloads/${PORTNAME}/
+
+MAINTAINER= scrappy@freebsd.org
+COMMENT= Allows Apache to log to a MySQL database
+
+LATEST_LINK= mod_log_sql2
+GNU_CONFIGURE= yes
+USE_BZIP2= yes
+USE_GMAKE= yes
+CONFIGURE_ARGS+= --with-apxs=${APXS}
+SSL_PLIST= ""
+PLIST_SUB+= SSL=${SSL_PLIST}
+
+USE_MYSQL= yes
+CONFIGURE_ENV+= LIBS="-L${LOCALBASE}/lib -L${LOCALBASE}/lib/mysql"
+
+.include <bsd.port.pre.mk>
+.if defined(WITH_DBI) || exists(${LOCALBASE}/include/dbi/dbi.h)
+CONFIGURE_ARGS+= --with-dbi=${LOCALBASE}
+LIB_DEPENDS+= dbi.0:${PORTSDIR}/databases/libdbi
+.endif
+.include "${PORTSDIR}/www/apache20/Makefile.modules.3rd"
+. if ${AP_VER} == 13
+WITHOUT_SSL= YES
+. endif
+.if defined(WITHOUT_SSL)
+CONFIGURE_ARGS+= --disable-ssl
+SSL_PLIST= "@comment "
+.else
+.if !exists(${LOCALBASE}/include/apache2/mod_ssl.h)
+BROKEN= Please recompile apache2 with SSL support
+.endif
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/www/mod_log_sql2-dtc/distinfo b/www/mod_log_sql2-dtc/distinfo
new file mode 100644
index 000000000000..6a83f1616423
--- /dev/null
+++ b/www/mod_log_sql2-dtc/distinfo
@@ -0,0 +1,3 @@
+MD5 (mod_log_sql-1.100.tar.bz2) = b54657ad270cffc34dfab12302c53306
+SHA256 (mod_log_sql-1.100.tar.bz2) = e9a49e01ecea00292ddec0a0bc4f33f0200dd7617bea11b0de92f1fd100025fc
+SIZE (mod_log_sql-1.100.tar.bz2) = 122507
diff --git a/www/mod_log_sql2-dtc/files/patch-functions13.h b/www/mod_log_sql2-dtc/files/patch-functions13.h
new file mode 100644
index 000000000000..4fda5d4d58bc
--- /dev/null
+++ b/www/mod_log_sql2-dtc/files/patch-functions13.h
@@ -0,0 +1,11 @@
+--- functions13.h.orig Fri Apr 16 15:03:25 2004
++++ functions13.h Fri Apr 16 15:03:46 2004
+@@ -37,7 +37,7 @@
+
+ static const char *extract_request_duration(request_rec *r, char *a)
+ {
+- return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time);
++ return ap_psprintf(r->pool, "%ld", (long)time(NULL) - r->request_time);
+ }
+
+ static const char *extract_request_timestamp(request_rec *r, char *a)
diff --git a/www/mod_log_sql2-dtc/files/patch-mod_log_sql.c b/www/mod_log_sql2-dtc/files/patch-mod_log_sql.c
new file mode 100644
index 000000000000..a503d4de43d9
--- /dev/null
+++ b/www/mod_log_sql2-dtc/files/patch-mod_log_sql.c
@@ -0,0 +1,110 @@
+--- mod_log_sql.c.orig Thu Feb 16 05:30:51 2006
++++ mod_log_sql.c Wed Nov 16 19:35:10 2005
+@@ -37,6 +37,11 @@
+ #define DEFAULT_HOUT_TABLE_NAME "headers_out"
+ #define DEFAULT_COOKIE_TABLE_NAME "cookies"
+ #define DEFAULT_PRESERVE_FILE "logs/mod_log_sql-preserve"
++#define DEFAULT_SCOREBOARD_DOMAIN "www"
++#define DEFAULT_SCOREBOARD_SUBDOMAIN "default-domain.tld"
++#define DEFAULT_SCOREBOARD_TABLE_NAME "scoreboard"
++
++#include <time.h>
+
+ /* -------------*
+ * DECLARATIONS *
+@@ -96,6 +101,9 @@
+ logsql_item **parsed_log_format;
+ const char *preserve_file;
+ const char *cookie_name;
++ const char *scoreboard_domain;
++ const char *scoreboard_subdomain;
++ const char *scoreboard_table_name;
+ } logsql_state;
+
+
+@@ -638,6 +646,9 @@
+ cls->hout_table_name = DEFAULT_HOUT_TABLE_NAME;
+ cls->cookie_table_name = DEFAULT_COOKIE_TABLE_NAME;
+ cls->preserve_file = DEFAULT_PRESERVE_FILE;
++ cls->scoreboard_domain = DEFAULT_SCOREBOARD_DOMAIN;
++ cls->scoreboard_subdomain = DEFAULT_SCOREBOARD_SUBDOMAIN;
++ cls->scoreboard_table_name = DEFAULT_SCOREBOARD_TABLE_NAME;
+
+ cls->transfer_ignore_list = apr_array_make(p, 1, sizeof(char *));
+ cls->transfer_accept_list = apr_array_make(p, 1, sizeof(char *));
+@@ -748,6 +759,15 @@
+ if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME)
+ child->cookie_table_name = parent->cookie_table_name;
+
++ if (child->scoreboard_domain == DEFAULT_SCOREBOARD_DOMAIN)
++ child->scoreboard_domain = parent->scoreboard_domain;
++
++ if (child->scoreboard_subdomain == DEFAULT_SCOREBOARD_SUBDOMAIN)
++ child->scoreboard_subdomain = parent->scoreboard_subdomain;
++
++ if (child->scoreboard_table_name == DEFAULT_SCOREBOARD_TABLE_NAME)
++ child->scoreboard_table_name = parent->scoreboard_table_name;
++
+ DO_MERGE_ARRAY(parent->transfer_ignore_list, child->transfer_ignore_list, subp);
+ DO_MERGE_ARRAY(parent->transfer_accept_list, child->transfer_accept_list, subp);
+ DO_MERGE_ARRAY(parent->remhost_ignore_list, child->remhost_ignore_list, subp);
+@@ -779,6 +799,10 @@
+ const char *hout_tablename = cls->hout_table_name;
+ const char *hin_tablename = cls->hin_table_name;
+ const char *cookie_tablename = cls->cookie_table_name;
++ const char *scoreboard_domain = cls->scoreboard_domain;
++ const char *scoreboard_subdomain = cls->scoreboard_subdomain;
++ const char *scoreboard_table_name = cls->scoreboard_table_name;
++ struct timeval now_time;
+
+ /* We handle mass virtual hosting differently. Dynamically determine the name
+ * of the table from the virtual server's name, and flag it for creation.
+@@ -1097,6 +1121,29 @@
+ if (cookie_query)
+ safe_sql_insert(orig, LOGSQL_TABLE_COOKIES,cookie_tablename,cookie_query);
+
++ gettimeofday(&now_time, (struct timeval*)0);
++
++ {
++ const char *score_query_insert;
++ const char *score_query_update;
++ struct tm *ptr;
++ time_t tm;
++ char sql_month[60];
++ char sql_year[60];
++ char a[60];
++
++ tm = time(NULL);
++ ptr = localtime(&tm);
++ strftime(sql_month ,100 , "\%m",ptr);
++ strftime(sql_year ,100 , "\%Y",ptr);
++
++ score_query_insert = apr_psprintf(r->pool, "insert ignore into %s (domain,vhost,month,year,count_impressions) values ('%s','%s','%s','%s','0')"
++ ,scoreboard_table_name,scoreboard_domain,scoreboard_subdomain,sql_month,sql_year);
++ safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_insert);
++ score_query_update = apr_psprintf(r->pool, "update %s SET count_impressions = count_impressions+1, bytes_sent = bytes_sent+%s WHERE domain='%s' AND vhost='%s' AND month='%s' AND year='%s'"
++ ,scoreboard_table_name,extract_bytes_sent(r, a),scoreboard_domain,scoreboard_subdomain,sql_month,sql_year);
++ safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_update);
++ }
+ return OK;
+ }
+ }
+@@ -1157,6 +1204,18 @@
+ AP_INIT_TAKE1("LogSQLCookieLogTable", set_server_nmv_string_slot,
+ (void *)APR_OFFSETOF(logsql_state, cookie_table_name), RSRC_CONF,
+ "The database table that holds the cookie info")
++ ,
++ AP_INIT_TAKE1("LogSQLScoreDomain", set_server_nmv_string_slot,
++ (void *)APR_OFFSETOF(logsql_state, scoreboard_domain), RSRC_CONF,
++ "The domain to set in scoreboard")
++ ,
++ AP_INIT_TAKE1("LogSQLScoreSubdomain", set_server_nmv_string_slot,
++ (void *)APR_OFFSETOF(logsql_state, scoreboard_subdomain), RSRC_CONF,
++ "The subdomain to set in scoreboard")
++ ,
++ AP_INIT_TAKE1("LogSQLScoreTable", set_server_nmv_string_slot,
++ (void *)APR_OFFSETOF(logsql_state, scoreboard_table_name), RSRC_CONF,
++ "The scoreboard to log in")
+ ,
+ /* Log format */
+ AP_INIT_TAKE1("LogSQLTransferLogFormat", set_logformat_slot,
diff --git a/www/mod_log_sql2-dtc/files/patch-mod_log_sql.h b/www/mod_log_sql2-dtc/files/patch-mod_log_sql.h
new file mode 100644
index 000000000000..29960604dc15
--- /dev/null
+++ b/www/mod_log_sql2-dtc/files/patch-mod_log_sql.h
@@ -0,0 +1,12 @@
+--- mod_log_sql.h.orig Thu Feb 16 05:32:07 2006
++++ mod_log_sql.h Thu Feb 16 05:32:33 2006
+@@ -67,7 +67,8 @@
+ LOGSQL_TABLE_NOTES,
+ LOGSQL_TABLE_HEADERSOUT,
+ LOGSQL_TABLE_HEADERSIN,
+- LOGSQL_TABLE_COOKIES
++ LOGSQL_TABLE_COOKIES,
++ LOGSQL_TABLE_SCORE
+ } logsql_tabletype;
+
+ /* All Tables */
diff --git a/www/mod_log_sql2-dtc/pkg-descr b/www/mod_log_sql2-dtc/pkg-descr
new file mode 100644
index 000000000000..cb25b6d20072
--- /dev/null
+++ b/www/mod_log_sql2-dtc/pkg-descr
@@ -0,0 +1,4 @@
+This add-on module allows the apache web server to use a MySQL database for
+logging of all operations.
+
+WWW: http://www.outoforder.cc/projects/apache/mod_log_sql/
diff --git a/www/mod_log_sql2-dtc/pkg-plist b/www/mod_log_sql2-dtc/pkg-plist
new file mode 100644
index 000000000000..0ef9f2f940ce
--- /dev/null
+++ b/www/mod_log_sql2-dtc/pkg-plist
@@ -0,0 +1,5 @@
+%%APACHEMODDIR%%/%%AP_MODULE%%
+@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F
+@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F
+%%APACHEMODDIR%%/mod_log_sql_mysql.so
+%%SSL%%%%APACHEMODDIR%%/mod_log_sql_ssl.so