Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Oct 2001 21:37:26 +0200 (CEST)
From:      Anders Nordby <anders@fix.no>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/31296: New port: www/mod_sqlinclude
Message-ID:  <20011015193726.31BA63D38@totem.fix.no>

next in thread | raw e-mail | index | archive | help

>Number:         31296
>Category:       ports
>Synopsis:       New port: www/mod_sqlinclude
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 15 12:40:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Anders Nordby
>Release:        FreeBSD 4.3-RELEASE i386
>Organization:
Fluxpod Information eXchange
>Environment:

	<Relevant environment information (multiple lines)>

>Description:

New port of mod_sqlinclude, an Apache module implementing config inclusion
from MySQL databases.

>How-To-Repeat:

	<Code/input/activities to reproduce the problem (multiple lines)>

>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	mod_sqlinclude
#	mod_sqlinclude/Makefile
#	mod_sqlinclude/distinfo
#	mod_sqlinclude/pkg-comment
#	mod_sqlinclude/pkg-descr
#	mod_sqlinclude/pkg-plist
#	mod_sqlinclude/pkg-message
#	mod_sqlinclude/files
#	mod_sqlinclude/files/patch-mod_sqlinclude.c
#	mod_sqlinclude/files/IMPORTANT-NOTES-FROM-MAINTAINER
#
echo c - mod_sqlinclude
mkdir -p mod_sqlinclude > /dev/null 2>&1
echo x - mod_sqlinclude/Makefile
sed 's/^X//' >mod_sqlinclude/Makefile << 'END-of-mod_sqlinclude/Makefile'
X# New ports collection makefile for:    mod_sqlinclude
X# Date created:				October 15 2001
X# Whom:					Anders Nordby <anders@fix.no>
X#
X# $FreeBSD$
X
XPORTNAME=	mod_sqlinclude
XPORTVERSION=	1.1
XCATEGORIES=	www
XMASTER_SITES=	http://wfmh.org.pl/~carlos/files/ \
X		ftp://ftp.nuug.no/pub/anders/distfiles/
XDISTNAME=	${PORTNAME}_${PORTVERSION}
XEXTRACT_SUFX=	.tgz
X
XMAINTAINER=	anders@fix.no
X
XBUILD_DEPENDS=	${APXS}:${PORTSDIR}/www/apache13
XLIB_DEPENDS=	mysqlclient.10:${PORTSDIR}/databases/mysql323-client
XRUN_DEPENDS=	${APXS}:${PORTSDIR}/www/apache13
X
XAPXS?=		${LOCALBASE}/sbin/apxs
XDOCS=	CHANGES.txt README.txt
X
Xdo-build:
X	(cd ${WRKSRC} && ${APXS} -c -I${LOCALBASE}/include \
X	-L${LOCALBASE}/lib/mysql -lmysqlclient mod_sqlinclude.c)
X
Xdo-install:
X	(cd ${WRKSRC} && ${APXS} -i -A -n 'sqlinclude' mod_sqlinclude.so)
X.if !defined(NOPORTDOCS)
X	@${INSTALL} -d -m 0755 ${DOCSDIR}
X.for f in ${DOCS}
X	${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}/
X.endfor
X	${INSTALL_DATA} ${FILESDIR}/IMPORTANT-NOTES-FROM-MAINTAINER ${DOCSDIR}/
X.endif
X
X.include <bsd.port.mk>
END-of-mod_sqlinclude/Makefile
echo x - mod_sqlinclude/distinfo
sed 's/^X//' >mod_sqlinclude/distinfo << 'END-of-mod_sqlinclude/distinfo'
XMD5 (mod_sqlinclude_1.1.tgz) = 61d934a8a1bc0ef92d86b400c8e7c49d
END-of-mod_sqlinclude/distinfo
echo x - mod_sqlinclude/pkg-comment
sed 's/^X//' >mod_sqlinclude/pkg-comment << 'END-of-mod_sqlinclude/pkg-comment'
XAn Apache module implementing config inclusion from MySQL databases
END-of-mod_sqlinclude/pkg-comment
echo x - mod_sqlinclude/pkg-descr
sed 's/^X//' >mod_sqlinclude/pkg-descr << 'END-of-mod_sqlinclude/pkg-descr'
Xmod_sqlinclude is an Apache module which implements Include-alike command,
Xwhich, as its origin, includes the external data into Apache configuration
Xfile, but instead of taking the real files SQLInclude fetches and includes data
Xfrom MySQL databases.
X
XWWW: http://wfmh.org.pl/~carlos/
X
X- Anders Nordby <anders@fix.no>
END-of-mod_sqlinclude/pkg-descr
echo x - mod_sqlinclude/pkg-plist
sed 's/^X//' >mod_sqlinclude/pkg-plist << 'END-of-mod_sqlinclude/pkg-plist'
Xlibexec/apache/mod_sqlinclude.so
X@exec %D/sbin/apxs -e -A -n sqlinclude %f
X@unexec %D/sbin/apxs -e -A -n sqlinclude %f
X%%PORTDOCS%%share/doc/mod_sqlinclude/CHANGES.txt
X%%PORTDOCS%%share/doc/mod_sqlinclude/README.txt
X%%PORTDOCS%%share/doc/mod_sqlinclude/IMPORTANT-NOTES-FROM-MAINTAINER
X%%PORTDOCS%%@dirrm share/doc/mod_sqlinclude
END-of-mod_sqlinclude/pkg-plist
echo x - mod_sqlinclude/pkg-message
sed 's/^X//' >mod_sqlinclude/pkg-message << 'END-of-mod_sqlinclude/pkg-message'
X************************************************************
XYou've installed mod_sqlinclude, an Apache module
Ximplementing config inclusion from MySQL databases.
X
XEdit your apache.conf or httpd.conf to enable and setup this
Xmodule. Be sure to have a look at the files in
X${PREFIX}/share/doc/mod_sqlinclude for information on how to
Xconfigure it etc.
X
XThen do this to make it work effective:
X
X# apachectl configtest (see if there are any config errors)
X# apachectl restart
X
X************************************************************
END-of-mod_sqlinclude/pkg-message
echo c - mod_sqlinclude/files
mkdir -p mod_sqlinclude/files > /dev/null 2>&1
echo x - mod_sqlinclude/files/patch-mod_sqlinclude.c
sed 's/^X//' >mod_sqlinclude/files/patch-mod_sqlinclude.c << 'END-of-mod_sqlinclude/files/patch-mod_sqlinclude.c'
X--- mod_sqlinclude.c.orig	Sun Jun 10 21:31:13 2001
X+++ mod_sqlinclude.c	Mon Oct 15 21:06:59 2001
X@@ -39,6 +39,7 @@
X 	int	UseNameColumn;
X 	int	AbortOnError;
X 	int	Verbose;
X+	char	sql_db[80];
X     
X 	char	*SocketFile;
X 	MYSQL	real_mysql;
X@@ -178,7 +179,7 @@
X 	for( i=0; i<2; i++ ) 	// Try it a few times
X 		{
X 		mysql_init( &conf->real_mysql );
X-		mysql = mysql_real_connect( &conf->real_mysql, conf->sql_server, conf->sql_user, conf->sql_password, NULL, conf->sql_port, conf->SocketFile, 0 );
X+		mysql = mysql_real_connect( &conf->real_mysql, conf->sql_server, conf->sql_user, conf->sql_password, conf->sql_db, conf->sql_port, conf->SocketFile, 0 );
X 		
X 		if( mysql )
X 			break;
X@@ -220,7 +221,7 @@
X 		else
X 			{
X 			if( ( ProcessEntry( cmd->server, cmd->pool, cmd->temp_pool, row, i ) == 0 ) &&
X-				 ( conf->AbortOnError == TRUE )
X+				 ( conf->AbortOnError == 1 )
X 			  )
X 				 	{
X 					goto error_exit;	// no further processing till this error is gone
X@@ -307,6 +308,15 @@
X 	conf->Verbose = arg;
X 	return(NULL);
X }
X+// sets sql database name
X+static const char *cmd_sqli_sqldb( cmd_parms *cmd, void *dummy, char *arg )
X+{
X+	server_rec *s = cmd->server;
X+	sqli_server_conf *conf = (sqli_server_conf *) ap_get_module_config(s->module_config, &sqlinclude_module);
X+
X+	strcpy( conf->sql_db, arg );
X+	return(NULL);
X+}
X 
X /*
X ** Let's allocate module config struct and fill with defaults
X@@ -324,9 +334,11 @@
X 		strcpy( c->sql_password, "" );
X 
X 		c->SocketFile = NULL;
X-		c->UseNameColumn = TRUE;
X-		c->AbortOnError = FALSE;
X-		c->Verbose = TRUE;
X+		c->UseNameColumn = 1;
X+		c->AbortOnError = 0;
X+		c->Verbose = 1;
X+
X+		strcpy( c->sql_db, "sqlinclude" );
X 		}
X 
X 	return c;
X@@ -356,6 +368,8 @@
X 		"On/Off - specifies if you want to use 2nd column as data description" },
X 	{ "SQL_Verbose", cmd_sql_verbose, NULL, RSRC_CONF, FLAG,
X 		"On/Off - specifies if you want to see more runtime messages or not. Default 'On'" },
X+	{ "SQL_SQLDB", cmd_sqli_sqldb, NULL, RSRC_CONF, TAKE1,
X+	 		"the MySQL database modules shall authenticate in. Default 'sqlinclude'" },
X 
X 	{ NULL }
X };
END-of-mod_sqlinclude/files/patch-mod_sqlinclude.c
echo x - mod_sqlinclude/files/IMPORTANT-NOTES-FROM-MAINTAINER
sed 's/^X//' >mod_sqlinclude/files/IMPORTANT-NOTES-FROM-MAINTAINER << 'END-of-mod_sqlinclude/files/IMPORTANT-NOTES-FROM-MAINTAINER'
XI added an Apache configuration option SQL_SQLDB, which you can use to set
Xwhich database name. I needed this to make mod_sqlinclude work at all. My test
Xconfiguration:
X
XNameVirtualHost 127.0.0.1
X
XSQL_ServerName localhost
XSQL_ServerPort 3306
XSQL_SQLDB sqlinclude
XSQL_SQLUser sqlinclude
XSQL_SQLPassword XXX
XSQL_UseNameColumn On
XSQL_Include "SELECT apache_data,id FROM sqlinclude"
X
XSQL_Include needs to be last, other settings that is put after it will not be
Xconsidered it seems.
X
XI used a DB structure that can be created like this:
X
XCREATE TABLE sqlinclude (
X  id int(11) NOT NULL auto_increment,
X  domain varchar(150) NOT NULL default '',
X  apache_data text,
X  PRIMARY KEY  (id)
X);
X
XTest configuration data:
X
Xmysql> select * from sqlinclude;
X+----+-------------------------+----------------------------------------------------------------------------------------------------------------+
X| id | domain                  | apache_data                                                                                                    |
X+----+-------------------------+----------------------------------------------------------------------------------------------------------------+
X|  1 | dummy.fupp.net          | <VirtualHost 127.0.0.1>
XServerName dummy.fupp.net
X
XDocumentRoot /home/anders/www
X</VirtualHost>
X |
X+----+-------------------------+----------------------------------------------------------------------------------------------------------------+
X1 row in set (0.00 sec)
X
X- Anders Nordby <anders@fix.no>
END-of-mod_sqlinclude/files/IMPORTANT-NOTES-FROM-MAINTAINER
exit

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011015193726.31BA63D38>