old-remove-schema-def.php 816 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/php
  2. <?php
  3. chdir(dirname(__FILE__));
  4. require_once 'common.php';
  5. assertCli();
  6. echo "Please do not run this script. It is here for historical purposes only.";
  7. exit;
  8. /**
  9. * @file
  10. * Removes ConfigSchema function calls from source files.
  11. */
  12. chdir(dirname(__FILE__) . '/../library/');
  13. $FS = new FSTools();
  14. $files = $FS->globr('.', '*.php');
  15. foreach ($files as $file) {
  16. if (substr_count(basename($file), '.') > 1) continue;
  17. $old_code = file_get_contents($file);
  18. $new_code = preg_replace("#^HTMLPurifier_ConfigSchema::.+?\);[\n\r]*#ms", '', $old_code);
  19. if ($old_code !== $new_code) {
  20. file_put_contents($file, $new_code);
  21. }
  22. if (preg_match('#^\s+HTMLPurifier_ConfigSchema::#m', $new_code)) {
  23. echo "Indented ConfigSchema call in $file\n";
  24. }
  25. }
  26. // vim: et sw=4 sts=4