Skip to content

Commit 8a4b83a

Browse files
committed
remove updates page, fix admin page to use cli commands properly
1 parent f258a72 commit 8a4b83a

6 files changed

Lines changed: 11 additions & 246 deletions

File tree

cli/includes/web.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
define('OB_CLI', true);
1414

1515
require_once(__DIR__ . '/../../core/init.php');
16-
require_once(__DIR__ . '/../../public/updates/checker.php');
1716

1817
$system_user = exec('whoami');
1918

20-
$checker = new \OBFChecker();
19+
$checker = new \OpenBroadcaster\Support\Checker();
2120

2221
$output = [];
2322
$output['system_user'] = exec('whoami');

core/cli/CheckInstall.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ class CheckInstall extends CLI
1010

1111
public function run(array $args): bool
1212
{
13-
require_once(__DIR__ . '/../../public/updates/checker.php');
14-
15-
$checker = new \OBFChecker();
13+
$checker = new \OpenBroadcaster\Support\Checker();
1614
$methods = get_class_methods($checker);
1715
$methods = array_filter($methods, fn($x) => $x !== '__construct');
1816
$rows = [];

core/init.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@
151151
$init_verify_running = false;
152152
if (!$init_verify_running && OB_INIT_VERIFY && is_array(OB_INIT_VERIFY) && !defined('OB_CLI')) {
153153
$init_verify_running = true;
154-
require_once(OB_LOCAL . '/public/updates/checker.php');
155-
$checker = new \OBFChecker();
154+
$checker = new \OpenBroadcaster\Support\Checker();
156155
$methods = get_class_methods($checker);
157156

158157
foreach (OB_INIT_VERIFY as $check) {

public/admin/run.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$theme = new SolarizedTheme();
1313
$converter = new AnsiToHtmlConverter($theme, false);
1414

15-
header('Content-type: application-json');
15+
header('Content-type: application/json');
1616

1717
$json = json_decode(file_get_contents('php://input'));
1818

@@ -32,17 +32,19 @@
3232
exit();
3333
}
3434

35-
$validCommands = ['check', 'cron run', 'updates list all', 'updates run all'];
35+
$validCommands = ['check install', 'cron run', 'updates list all', 'updates run all'];
3636
if (in_array($json->command, $validCommands)) {
3737
$output = [];
3838
$resultCode = 0;
39-
exec(__DIR__ . "/../../tools/cli/ob {$json->command}", $output);
39+
$commandStr = __DIR__ . "/../../cli/ob {$json->command}";
40+
41+
exec($commandStr, $output, $resultCode);
4042

4143
$output = $converter->convert(implode(PHP_EOL, $output));
4244
if ($output === "" && $resultCode === 0) {
4345
$output = $converter->convert('No output. Command ran successfully.');
4446
} elseif ($output === "") {
45-
$output = $converter->convert('An error occurred running the command but no output was provided.');
47+
$output = $converter->convert('An error occurred (' . $resultCode . ') running the command but no output was provided.');
4648
}
4749

4850
echo json_encode([

public/admin/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function run(data)
1212
});
1313

1414
const output = document.querySelector("#cli-output");
15-
15+
1616
response.json().then((data) => {
1717
if (! response.ok) {
1818
output.innerHTML += '<p class="error">' + data.message + '</p>';
@@ -27,7 +27,7 @@ async function run(data)
2727
async function cliCheck()
2828
{
2929
const data = {
30-
command: "check"
30+
command: "check install"
3131
};
3232

3333
run(data);

public/updates/index.php

Lines changed: 0 additions & 233 deletions
This file was deleted.

0 commit comments

Comments
 (0)