Hallo,
ich möchte die Funktion "mysql_query" um einen Debug parameter erweitern:
function mysql_query($query, $server="localhost") {
debug(ntime(),"MySQL Query ($server)) // Diese Funktion erzeugt ein Debug Array....
return mysql_query($query,$server);
}
Hat jemand eine Idee wie ich eine bestehende PHP Function (mysql_query etc.) erweitern kann?
Meine Möglichkeiten:
1. Mit APD und der function rename_function ... (Nur will ich auf diesem Server kein APD laden)
2. Alle Funktionsaufrufe ändnr in sql_query und dann meine erweiterte Funktion sql_query aufrufen statt mysql_query... (Da die Seite schon recht weit ist wären dass einige tausend Änderungen, also auch schlecht)
Hat jemand eine Idee?
Vielen Dank
PHP Function erweitern?
Re: PHP Function erweitern?
Code: Select all
for file in `find . -type f -name *.php`; do
sed 's/mysql_query/sql_query/g' -i ${file};
done
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
Roger Wilco
- Posts: 5923
- Joined: 2004-05-23 12:53
Re: PHP Function erweitern?
Useless use of for? ;)Joe User wrote:Code: Select all
for file in `find . -type f -name *.php`; do sed 's/mysql_query/sql_query/g' -i ${file}; done
Code: Select all
find . -type f -name *.php -exec sed 's/mysql_query/sql_query/g' -i {} ;Re: PHP Function erweitern?
Na dann:Roger Wilco wrote:Und ja, mir war langweilig. ;)
Code: Select all
for file in `find . -type f -name *.php`; do
sed 's/(^[[:space:]]*global[[:space:]].*)[,][[:space:]]*$HTTP_[A-Z][A-Z]*_(VARS|FILES)/1/g' -i ${file} &&
sed 's/(^[[:space:]]*global[[:space:]].*)$HTTP_[A-Z][A-Z]*_(VARS|FILES)([,][[:space:]]*)*/1/g' -i ${file} &&
sed 's/(^[[:space:]]*global[[:space:]].*)[,][[:space:]]*[;]$/1;/g' -i ${file} &&
sed '/^[[:space:]]*global[[:space:]]([[:space:]]*[,]*)*[;]$/d' -i ${file} &&
sed 's/HTTP(_[A-Z][A-Z]*)_VARS/1/g' -i ${file} &&
sed 's/HTTP_[A-Z][A-Z]*_FILES/_FILES/g' -i ${file};
done
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: PHP Function erweitern?
Datenbank-Abstraktionslayer wie PEAR::MDB2 oder ADODB sind dir bekannt?DjBennyF wrote:2. Alle Funktionsaufrufe ändnr in sql_query und dann meine erweiterte Funktion sql_query aufrufen statt mysql_query... (Da die Seite schon recht weit ist wären dass einige tausend Änderungen, also auch schlecht)
bye
arty

