You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 line
972B

  1. #!/usr/bin/php
  2. <?php
  3. chdir(dirname(__FILE__));
  4. require_once 'common.php';
  5. assertCli();
  6. /**
  7. * @file
  8. * Converts all instances of $config->set and $config->get to the new
  9. * format, as described by docs/dev-config-bcbreaks.txt
  10. */
  11. $FS = new FSTools();
  12. chdir(dirname(__FILE__) . '/..');
  13. $raw_files = $FS->globr('.', '*.php');
  14. foreach ($raw_files as $file) {
  15. $file = substr($file, 2); // rm leading './'
  16. if (strpos($file, 'library/standalone/') === 0) continue;
  17. if (strpos($file, 'maintenance/update-config.php') === 0) continue;
  18. if (strpos($file, 'test-settings.php') === 0) continue;
  19. if (substr_count($file, '.') > 1) continue; // rm meta files
  20. // process the file
  21. $contents = file_get_contents($file);
  22. $contents = preg_replace(
  23. "#config->(set|get)\('(.+?)', '(.+?)'#",
  24. "config->\\1('\\2.\\3'",
  25. $contents
  26. );
  27. if ($contents === '') continue;
  28. file_put_contents($file, $contents);
  29. }
  30. // vim: et sw=4 sts=4