2

This is a linux shell command which will comment all require_once calls from certain directory in php files:

  % cd path/to/ZendFramework/library
  % find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' \
    -not -wholename '*/Application.php' -print0 | \
    xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'

But how could I do that in Windows OS cmd?

This is to speed up a Zend Framework application.

EDIT:

On one line:

find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' -not -wholename */Application.php' -print0 | xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'
Richard Knop
  • 1,089
  • 2
  • 19
  • 33

2 Answers2

3

With this and this.

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84
1

FYI, on Windows, I could not get xargs working for some reason, but this is the command I ran through Git Bash shell:

find . -name '*.php' -print0 | xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'

Then, manually recopy the Loader.php and Application.php file back over the sedited ones.

Jonathan
  • 11
  • 1