[Fusionforge-commits] r9392 - trunk/tools

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Apr 6 21:51:15 CEST 2010


Author: lolando
Date: 2010-04-06 21:51:15 +0200 (Tue, 06 Apr 2010)
New Revision: 9392

Added:
   trunk/tools/unify_config.sh
Log:
Added script used to help with the config API transition

Added: trunk/tools/unify_config.sh
===================================================================
--- trunk/tools/unify_config.sh	                        (rev 0)
+++ trunk/tools/unify_config.sh	2010-04-06 19:51:15 UTC (rev 9392)
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+# Usage: unify_config.sh <old variable> <new variable> [ <section> ]
+# Example: unify_config.sh sys_default_domain web_host
+
+old=$1
+new=$2
+sect=$3
+
+if [ "$sect" = "" ] ; then
+    newstr="forge_get_config('$new')"
+else
+    newstr="forge_get_config('$new', '$sect')"
+fi
+
+find_files () {
+    ack-grep -l --php $old | grep -v www/include/pre.php
+}
+
+find_files | xargs perl -pi -e"s/(\\s*global .*)\\\$$old, */\\1/"
+find_files | xargs perl -pi -e"s/(\\s*global .*)\\\$$old *;//"
+find_files | xargs perl -pi -e"s,\\\$GLOBALS\['$old'\](?"\!"\\s*=),$newstr,g"
+find_files | xargs perl -pi -e"s,\\\$GLOBALS\[$old\](?"\!"\\s*=),$newstr,g"
+find_files | xargs perl -pi -e"s,\\\$$old(?"\!"\\s*=),$newstr,g"


Property changes on: trunk/tools/unify_config.sh
___________________________________________________________________
Added: svn:executable
   + *




More information about the Fusionforge-commits mailing list