-
Notifications
You must be signed in to change notification settings - Fork 36
/
diff.php
executable file
·42 lines (36 loc) · 1.26 KB
/
diff.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env php
<?php
$shell = "";
switch (PHP_OS) {
case 'Linux':
$shell = "./bin/swoole-cli -m | tail -n +2 | head -n -3 ";
break;
case 'Darwin':
$shell = "./bin/swoole-cli -m | tail -n +2 | ghead -n -3 ";
break;
case 'WINNT':
default:
echo "no support this OS ";
exit(0);
}
$list_swoole_cli = swoole_string(`$shell`)->trim()->lower()->split(PHP_EOL)
->remove('core');
ob_start();
$php_source_folder = require_once __DIR__ . '/sapi/scripts/download-php-src-archive.php';
ob_end_clean();
$list_php_src = swoole_string(`ls -1 {$php_source_folder}/ext/`)->trim()->lower()->split(PHP_EOL)
->remove('ext_skel.php')
->remove('zend_test');
$list_intersect = array_intersect($list_php_src->toArray(), $list_swoole_cli->toArray());
$diff1 = array_diff($list_swoole_cli->toArray(), $list_intersect);
echo "Added(" . count($diff1) . ")\n===============================================================\n";
foreach ($diff1 as $v) {
echo '+ ' . $v . PHP_EOL;
}
echo PHP_EOL;
$diff2 = array_diff($list_php_src->toArray(), $list_intersect);
echo "Removed(" . count($diff2) . ")\n==============================================================\n";
foreach ($diff2 as $v) {
echo '- ' . $v . PHP_EOL;
}
echo PHP_EOL;