I'm creating small algorithm to fix msgid entire source code so this working ok:
$ find . -name '*.php' | xargs perl -pi -e 's/\$t\(\047bad msgid\047\);/\$t\(\047good msg id\047\);/g'
I want to create execute inside foreach of php script eg:
$cmd = "find {$projectPath} -name '*.php' | xargs perl -pi -e 's/\$t\('\047'" . preg_quote($bad) . "\047\)/\$t\(\047" . preg_quote($good) . "\047\)/g'";
exec(escapeshellarg($cmd));
Its crazy i try everything, escapeshellarg, mix doubled quotes with single quotes, backslash quotes.. after 4h i can tell one fu*ck this and shell exec cmd. ps. fuc*k reg exp too
any idea to run this command inside exec method ?
Solution for find $t('misspel msgid') replace to $t('right msgid') inside entire project usind php, perl, exec (tested on mac)
+1h and 2rev, thanks for suggestion @Marc B:
$cmd = "find {$projectPath} -name '*.php' | xargs perl -pi -e 's|\\\$t\(\\047" . str_replace("'", "\\047", preg_quote($bad)) . "\\047\)|\\\$t\(\\047" . str_replace("'", "\\047", preg_quote($good)) . "\\047\)|g'";
exec($cmd);