]> git.mxchange.org Git - friendica.git/blob - util/typo.php
Store conversation data
[friendica.git] / util / typo.php
1 #!/usr/bin/env php
2 <?php
3
4 // Tired of chasing typos and finding them after a commit.
5 // Run this from cmdline in basedir and quickly see if we've
6 // got any parse errors in our application files.
7
8 use Friendica\App;
9
10 error_reporting(E_ERROR | E_WARNING | E_PARSE);
11 ini_set('display_errors', '1');
12 ini_set('log_errors', '0');
13
14 include 'boot.php';
15
16 $a = new App(dirname(__DIR__));
17
18 if (x($a->config, 'php_path')) {
19         $phpath = $a->config['php_path'];
20 } else {
21         $phpath = 'php';
22 }
23
24 echo 'Directory: src' . PHP_EOL;
25 $Iterator = new RecursiveDirectoryIterator('src');
26
27 foreach (new RecursiveIteratorIterator($Iterator) as $file) {
28         if (substr($file, -4) === '.php') {
29                 passthru("$phpath -l $file", $ret);
30                 $ret === 0 || die();
31         }
32 }
33
34 echo "Directory: mod\n";
35 $files = glob('mod/*.php');
36 foreach ($files as $file) {
37         passthru("$phpath -l $file", $ret);
38         $ret === 0 || die();
39 }
40
41 echo "Directory: include\n";
42 $files = glob('include/*.php');
43 foreach ($files as $file) {
44         passthru("$phpath -l $file", $ret);
45         $ret === 0 || die();
46 }
47
48 echo "Directory: object\n";
49 $files = glob('object/*.php');
50 foreach ($files as $file) {
51         passthru("$phpath -l $file", $ret);
52         $ret === 0 || die();
53 }
54
55 echo "Directory: addon\n";
56 $dirs = glob('addon/*');
57
58 foreach ($dirs as $dir) {
59         $addon = basename($dir);
60         $files = glob($dir . '/' . $addon . '.php');
61         foreach ($files as $file) {
62                 passthru("$phpath -l $file", $ret);
63                 $ret === 0 || die();
64         }
65 }
66
67 echo "String files\n";
68
69 echo 'util/strings.php' . "\n";
70 passthru("$phpath -l util/strings.php", $ret);
71 $ret === 0 || die();
72
73 $files = glob('view/lang/*/strings.php');
74 foreach ($files as $file) {
75         passthru("$phpath -l $file", $ret);
76         $ret === 0 || die();
77 }