17 lines
988 B
PHP
17 lines
988 B
PHP
<?php
|
|
require getcwd() . '/vendor/autoload.php';
|
|
$app = require getcwd() . '/bootstrap/app.php';
|
|
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
|
$opts = getopt('', ['backup:']);
|
|
$dir = $opts['backup'] ?? throw new RuntimeException('Missing backup');
|
|
$m = json_decode(file_get_contents("$dir/manifest.json"), true, flags: JSON_THROW_ON_ERROR);
|
|
$node = App\Models\Server::findOrFail($m['node_id']);
|
|
$qa = App\Models\User::findOrFail($m['test_user_id']);
|
|
echo json_encode([
|
|
'node_id' => $node->id, 'name' => $node->name, 'is_online' => $node->is_online,
|
|
'last_check_at' => $node->last_check_at, 'last_push_at' => $node->last_push_at,
|
|
'qa_upload' => $qa->u, 'qa_download' => $qa->d, 'qa_banned' => $qa->banned,
|
|
'plans' => App\Models\Plan::orderBy('id')->get(['id', 'group_id']),
|
|
'existing_users_with_selected_plan_and_null_group' => App\Models\User::whereIn('plan_id', [1,6,7,8])->whereNull('group_id')->count(),
|
|
], JSON_UNESCAPED_UNICODE) . PHP_EOL;
|