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