Files
addons
app_download_files
extend
hyhproject
mobile
oss
static
thinkphp
upload
vendor
5ini99
composer
oss-sdk
swoole
.github
benchmark
examples
include
src
tests
thirdparty
tools
arginfo_check.php
check-package.php
export.php
gen-data.php
ip.php
travis
.gitignore
.gitmodules
.travis.yml
CMakeLists.txt
CREDITS
LICENSE
README.md
Version2.md
build.sh
clear.sh
config.m4
make.sh
package.xml
php7_wrapper.h
php_swoole.h
swoole.c
swoole_async.c
swoole_atomic.c
swoole_buffer.c
swoole_channel.c
swoole_channel_coro.cc
swoole_client.c
swoole_client_coro.c
swoole_config.h
swoole_coroutine.cc
swoole_coroutine.h
swoole_coroutine_util.c
swoole_event.c
swoole_http.h
swoole_http_client.c
swoole_http_client.h
swoole_http_client_coro.c
swoole_http_server.c
swoole_http_v2_client.c
swoole_http_v2_client.h
swoole_http_v2_client_coro.c
swoole_http_v2_server.c
swoole_lock.c
swoole_memory_pool.c
swoole_mmap.c
swoole_msgqueue.c
swoole_mysql.c
swoole_mysql.h
swoole_mysql_coro.c
swoole_postgresql_coro.c
swoole_postgresql_coro.h
swoole_process.c
swoole_process_pool.c
swoole_redis.c
swoole_redis_coro.c
swoole_redis_server.c
swoole_ringqueue.c
swoole_runtime.cc
swoole_serialize.c
swoole_serialize.h
swoole_server.c
swoole_server_port.c
swoole_socket_coro.c
swoole_table.c
swoole_timer.c
swoole_trace.c
swoole_websocket_server.c
wechat
.htaccess
autoload.php
wxtmp
.gitignore
.htaccess
.user.ini
404.html
H5B854518.wgt
admin.php
app-release.apk
app_download.html
cash.lock
demo.php
get_startup.php
get_version.php
get_version_new.php
hyhproject.tar.gz
index.html
index.php
reg.lock
robots.txt
qlg.tsgz.moe/vendor/swoole/tools/check-package.php
2019-09-06 23:53:10 +08:00

78 lines
1.3 KiB
PHP
Executable File

#!/usr/bin/env php
<?php
define('BASE_DIR', dirname(__DIR__));
if (empty($argv[1]))
{
$DIR = BASE_DIR . '/tests';
}
else
{
$DIR = BASE_DIR . '/' . $argv[1];
}
$role = empty($argv[2]) ? 'test' : 'src';
$cmd = empty($argv[3]) ? 'list' : 'check';
$_files = [];
search($DIR, $_files);
foreach ($_files as $f)
{
$filename = str_replace($DIR . '/', '', $f);
if ($cmd == 'list')
{
echo '<file name="' . $filename . '" role="' . $role . '" />' . "\n";
}
elseif ($cmd == 'check')
{
if (!inPackage($filename))
{
echo "$filename\n";
}
}
}
function search($path, &$_files)
{
$dirs = _scandir($path);
foreach ($dirs as $d)
{
$_path = $path . '/' . $d;
if (!is_dir($_path))
{
$_files[] = $_path;
continue;
}
else
{
search($_path, $_files);
}
}
}
function _scandir($dir)
{
$list = scandir($dir);
return array_filter($list, function ($f)
{
return $f[0] !== '.';
});
}
function inPackage($file)
{
static $content = null;
if (!$content)
{
$content = file_get_contents(BASE_DIR . '/package.xml');
}
if (strpos($content, $file) === false)
{
return false;
}
else
{
return true;
}
}