aboutsummaryrefslogtreecommitdiffstats
path: root/www/mod_php3
diff options
context:
space:
mode:
authorroam <roam@FreeBSD.org>2004-06-03 23:49:13 +0800
committerroam <roam@FreeBSD.org>2004-06-03 23:49:13 +0800
commit31d8c87cafa6a4668788756cbabaa1a45ae48717 (patch)
tree2fbf00fa4349dd84db0f99898557c18caf479de2 /www/mod_php3
parentcfb239097aa4956e695c7a48bb6beefbf3f37e83 (diff)
downloadfreebsd-ports-gnome-31d8c87cafa6a4668788756cbabaa1a45ae48717.tar.gz
freebsd-ports-gnome-31d8c87cafa6a4668788756cbabaa1a45ae48717.tar.zst
freebsd-ports-gnome-31d8c87cafa6a4668788756cbabaa1a45ae48717.zip
Commit something that I've been sitting on for just about months now:
make the PHP3 ports work with any version of MySQL, not just 3.23.x. The main (actually, the only) problem was that MySQL 4.x no longer has mysql_drop_db() and mysql_create_db() as separate functions, and just as mentioned in the manual, the solution is to use mysql_query() (or rather, mysql_real_query()) and emulate them.
Diffstat (limited to 'www/mod_php3')
-rw-r--r--www/mod_php3/Makefile4
-rw-r--r--www/mod_php3/files/patch-functions::mysql.c52
-rw-r--r--www/mod_php3/scripts/configure.php2
3 files changed, 55 insertions, 3 deletions
diff --git a/www/mod_php3/Makefile b/www/mod_php3/Makefile
index 9a12ba4a4369..910d54933a64 100644
--- a/www/mod_php3/Makefile
+++ b/www/mod_php3/Makefile
@@ -7,7 +7,7 @@
PORTNAME?= mod_php3
PORTVERSION= 3.0.18
-PORTREVISION?= 3
+PORTREVISION?= 4
CATEGORIES?= www
MASTER_SITES= ${MASTER_SITE_PHP}
MASTER_SITE_SUBDIR= distributions
@@ -102,7 +102,7 @@ post-clean:
# Has to be kept in sync with the defaults in configure.php
.ifndef(WITHOUT_MYSQL)
.ifmake describe
-LIB_DEPENDS+= mysqlclient.10:${PORTSDIR}/databases/mysql323-client
+USE_MYSQL= yes
.endif
.endif
diff --git a/www/mod_php3/files/patch-functions::mysql.c b/www/mod_php3/files/patch-functions::mysql.c
new file mode 100644
index 000000000000..cbf509ecb039
--- /dev/null
+++ b/www/mod_php3/files/patch-functions::mysql.c
@@ -0,0 +1,52 @@
+--- functions/mysql.c.orig Thu Jun 3 13:17:04 2004
++++ functions/mysql.c Thu Jun 3 13:17:09 2004
+@@ -785,7 +785,9 @@
+ void php3_mysql_create_db(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *db,*mysql_link;
+- int id,type;
++ int id,type,res;
++ char *qbuf;
++ size_t qsize;
+ MYSQL *mysql;
+ MySQL_TLS_VARS;
+
+@@ -818,7 +820,12 @@
+ }
+
+ convert_to_string(db);
+- if (mysql_create_db(mysql,db->value.str.val)==0) {
++ qsize = strlen(db->value.str.val) + 20;
++ qbuf = (char *)emalloc(qsize);
++ snprintf(qbuf, qsize, "CREATE DATABASE %s", db->value.str.val);
++ res = mysql_real_query(mysql,qbuf,strlen(qbuf));
++ efree(qbuf);
++ if (res) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
+@@ -831,7 +838,9 @@
+ void php3_mysql_drop_db(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ pval *db,*mysql_link;
+- int id,type;
++ int id,type,res;
++ char *qbuf;
++ size_t qsize;
+ MYSQL *mysql;
+ MySQL_TLS_VARS;
+
+@@ -864,7 +873,12 @@
+ }
+
+ convert_to_string(db);
+- if (mysql_drop_db(mysql,db->value.str.val)==0) {
++ qsize = strlen(db->value.str.val) + 20;
++ qbuf = (char *)emalloc(qsize);
++ snprintf(qbuf, qsize, "DROP DATABASE %s", db->value.str.val);
++ res = mysql_real_query(mysql,qbuf,strlen(qbuf));
++ efree(qbuf);
++ if (res) {
+ RETURN_TRUE;
+ } else {
+ RETURN_FALSE;
diff --git a/www/mod_php3/scripts/configure.php b/www/mod_php3/scripts/configure.php
index 8770231603c8..af41539f1fa5 100644
--- a/www/mod_php3/scripts/configure.php
+++ b/www/mod_php3/scripts/configure.php
@@ -90,7 +90,7 @@ while [ "$1" ]; do
echo "CONFIGURE_ARGS+=--with-imap=\${PREFIX}"
;;
\"MySQL\")
- echo "LIB_DEPENDS+= mysqlclient.10:\${PORTSDIR}/databases/mysql323-client"
+ echo "USE_MYSQL= yes"
echo "CONFIGURE_ARGS+=--with-mysql=\${PREFIX}"
MYSQL=1
;;