[nmglug] myphpmoney - mass editing .php files

Aaron eunichs at boim.com
Tue Dec 5 05:49:32 PST 2006


Tim Emerick wrote:
> Hey gang.
> 
> I tried to install myphpmoney on my ubuntu server and it sure was a challenge.  Needless to say I got it mostly running but need a little help.  Apparently it was written for MySQL 4 but I have MySQL5 running.  I found a fix on google groups but I don't know how to implement it.  It involves changing all occurences of OUT to `OUT` in all of the php scripts since OUT is now a reserved word in mysql5. How do I do that?
> 
> Here are the citations I found
> 
> -----cause-----
> Package: myphpmoney 
>  Version: 1.3RC3+dfsg-1 
>  Severity: important 
>  After upgrading the mysql server to newer version 5, myphpmoney is unusable, it 
>  compains that there is a error on the sql syntax, near 'OUT'. 

I don't know MySQL... but perhaps something like:

grep OUT *.php   # check that it's getting MOSTLY the right stuff

foreach f ( *.php )
  echo =========== $f
  sed s/OUT/\'OUT\'/g $f > t
  mv t $f
end

grep OUT *.php    # fix the wrong OUT replacements...


DO NOT run this as written.   I'm not sure how sed deals with the
quotes.  Try it on a test copy of a file first!




More information about the nmglug mailing list