mirror of
https://git.FreeBSD.org/ports.git
synced 2025-02-02 11:09:29 +00:00
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.
This commit is contained in:
parent
8d9296b221
commit
f2b221a357
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=110781
@ -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
|
||||
|
||||
|
52
www/mod_php3/files/patch-functions::mysql.c
Normal file
52
www/mod_php3/files/patch-functions::mysql.c
Normal file
@ -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;
|
@ -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
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user