fix_style.php 439 B

123456789101112131415161718192021222324
  1. <?php
  2. if (php_sapi_name() !== "cli") {
  3. die('CLI only');
  4. }
  5. $root = dirname(__DIR__);
  6. if (!is_writable($root)) {
  7. echo "$root is not writable.\n";
  8. exit(1);
  9. }
  10. require "$root/engine/classes/Elgg/Project/CodeStyle.php";
  11. $style = new Elgg\Project\CodeStyle();
  12. $report = $style->fixDirectory($root);
  13. if (!$report) {
  14. exit;
  15. }
  16. $json_opts = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
  17. echo json_encode($report, $json_opts) . "\n";