]> git.mxchange.org Git - friendica.git/blob - util/typo.php
Remove util/extract
[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
9 use Friendica\App;
10 use Friendica\BaseObject;
11
12 error_reporting(E_ERROR | E_WARNING | E_PARSE);
13 ini_set('display_errors', '1');
14 ini_set('log_errors', '0');
15
16 include 'boot.php';
17
18 $a = new App(dirname(__DIR__));
19 BaseObject::setApp($a);
20
21 @include '.htconfig.php';
22
23 $phpath = $a->getConfigValue('config', 'php_path', 'php');
24
25 echo 'Directory: src' . PHP_EOL;
26 $Iterator = new RecursiveDirectoryIterator('src');
27
28 foreach (new RecursiveIteratorIterator($Iterator) as $file) {
29         if (substr($file, -4) === '.php') {
30                 passthru("$phpath -l $file", $ret);
31                 $ret === 0 || die();
32         }
33 }
34
35 echo "Directory: mod\n";
36 $files = glob('mod/*.php');
37 foreach ($files as $file) {
38         passthru("$phpath -l $file", $ret);
39         $ret === 0 || die();
40 }
41
42 echo "Directory: include\n";
43 $files = glob('include/*.php');
44 foreach ($files as $file) {
45         passthru("$phpath -l $file", $ret);
46         $ret === 0 || die();
47 }
48
49 echo "Directory: object\n";
50 $files = glob('object/*.php');
51 foreach ($files as $file) {
52         passthru("$phpath -l $file", $ret);
53         $ret === 0 || die();
54 }
55
56 echo "Directory: addon\n";
57 $dirs = glob('addon/*');
58
59 foreach ($dirs as $dir) {
60         $addon = basename($dir);
61         $files = glob($dir . '/' . $addon . '.php');
62         foreach ($files as $file) {
63                 passthru("$phpath -l $file", $ret);
64                 $ret === 0 || die();
65         }
66 }
67
68 echo "String files\n";
69
70 echo 'util/strings.php' . "\n";
71 passthru("$phpath -l util/strings.php", $ret);
72 $ret === 0 || die();
73
74 $files = glob('view/lang/*/strings.php');
75 foreach ($files as $file) {
76         passthru("$phpath -l $file", $ret);
77         $ret === 0 || die();
78 }