Files
HotLunches/map.mysql.sh
T
2026-10-19 15:22:52 -07:00

30 lines
913 B
Bash

#!/bin/sh
for file in `grep -l mysql_ *.php`
do
echo $file
cp $file tmp.file
cp $file save
{
cat tmp.file | sed 's/mysql_affected_rows/db_affected_rows/g' | \
sed 's/mysql_query/db_query/g' | \
sed 's/mysql_escape_string/db_escape_string/g' | \
sed 's/mysql_real_escape_string/db_escape_string/g' | \
sed 's/mysql_fetch_array(\(.*\),MYSQL_ASSOC/db_fetch_assoc(\1/g' | \
sed 's/,MYSQL_NUM//g' | \
sed 's/mysql_fetch_array/db_fetch_array/g' | \
sed 's/mysql_insert_id/db_insert_id/g' | \
sed 's/mysql_affected_rows/db_affected_rows/g' | \
sed 's/mysql_close/db_close/g' | \
sed 's/mysql_num_rows/db_num_rows/g' | \
sed 's/ split(/ explode(/g'
} > tmp2.file
rm tmp.file
mv tmp2.file $file
chown webftp.users $file
done