Re: Conf Changes (#138)

Jean-Christophe Michel <jc.michel-/aRvmaKoZxNWk0Htik3J/[email protected]> Wed, 09 Mar 2005 22:57:41 +0100
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
Manuel Holtgrewe wrote:
> To upgrade your own code to use the new style conf, you have to do the
> following:
> 
> - Replace "Conf::getInstance(.*?) Conf::getInstance()"
> - Replace "->getConf('" by "->getConf('/"
> - Replace "name=" with "id=" in your conf.xml files
> - Replace "raw" typed configuration settings by "@COSTANT_NAME@" or
> replace it with something in your PHP code.

Here is a tool for *unix users to replace things:
(c) jcm 2005 LGPL

8>< ===========================> replace.sh
#!/bin/sh

if [ $# -ne 3 ] ;
then
     echo replace.sh
     echo
     echo Syntax: replace.sh 'search' 'replace' base-dir
     exit
fi

for f in $(grep -R -l -E "$1" "$3") ; do
     sed -r "s/$1/$2/g" "$f" > "$f.sed"
     mv "$f.sed" "$f"
     echo $f
done
echo "done."
8>< ======================================================

then
  cd YOUR_WORKSPACE
  ~/replace.sh "Conf::getInstance\(.+\)" "Conf::getInstance()"
  ~/replace.sh ">getConf\('" ">getConf('/"
  ~/replace.sh " name=" " id=" conf
  ~/replace.sh " type=\"raw\">([A-Z_]+)(\.'(.+)')?<" ">@\1@\3<" conf
-- 
Jean-Christophe Michel
_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev