Skip to content

Commit f258a72

Browse files
committed
updates/checker moved to core for future changes
1 parent 2ef2107 commit f258a72

5 files changed

Lines changed: 28 additions & 18 deletions

File tree

core/cli/UpdatesList.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ public function run(array $args): bool
4646

4747
private function listUpdates($type = 'core', $module = null)
4848
{
49-
require_once(__DIR__ . '/../../public/updates/updates.php');
50-
5149
if ($type === 'core') {
5250
// List all core updates.
53-
$list = $u->updates();
51+
$list = (new \OpenBroadcaster\Support\Updates())->updates();
5452
} elseif ($module !== null) {
5553
// List specified module updates.
56-
$list = (new \OBFUpdates($module))->updates();
54+
$list = (new \OpenBroadcaster\Support\Updates($module))->updates();
5755
} else {
5856
// List all module updates.
5957
$modules = array_filter(scandir(__DIR__ . '/../../modules/'), fn($f) => $f[0] !== '.');

core/cli/UpdatesRun.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ public function run(array $args): bool
4747

4848
function runUpdates($type = 'core', $module = null)
4949
{
50-
require_once(__DIR__ . '/../../public/updates/updates.php');
51-
5250
if ($type === 'core') {
5351
// Run all core updates.
52+
$u = new \OpenBroadcaster\Support\Updates();
5453
$list = $u->updates();
5554
} elseif ($module !== null) {
5655
$this->db->where('directory', $module);
@@ -61,7 +60,7 @@ function runUpdates($type = 'core', $module = null)
6160
}
6261

6362
// Run specified module updates.
64-
$u = new \OBFUpdates($module);
63+
$u = new \OpenBroadcaster\Support\Updates($module);
6564
$list = $u->updates();
6665
} else {
6766
// Run all module updates.
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<?php
22

3-
// Copyright 2012-2025 OpenBroadcaster, Inc.
3+
// Copyright 2012-2026 OpenBroadcaster, Inc.
44
// SPDX-License-Identifier: AGPL-3.0-or-later
55

6+
/**
7+
* Class to check for problems with the installation.
8+
*
9+
* @package Support
10+
*/
11+
namespace OpenBroadcaster\Support;
12+
613
// verify the OB installation. each method will be run, and should return array(NAME, DESCRIPTION (string or array), STATUS=success (0) / warning (1) / error (2) ).
714
// if error is returned, subsequent methods will not be run.
8-
class OBFChecker
15+
class Checker
916
{
1017
public function __construct($module = null)
1118
{
@@ -189,7 +196,7 @@ public function config_file_valid()
189196
// }
190197
// }
191198

192-
if (!PHPMailer\PHPMailer\PHPMailer::ValidateAddress(OB_EMAIL_REPLY)) {
199+
if (! \PHPMailer\PHPMailer\PHPMailer::ValidateAddress(OB_EMAIL_REPLY)) {
193200
$errors[] = 'OB_EMAIL_REPLY (email address used to send emails) is not valid.';
194201
}
195202
if (trim(OB_EMAIL_FROM) == '') {
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
<?php
22

3-
// Copyright 2012-2024 OpenBroadcaster, Inc.
3+
// Copyright 2012-2026 OpenBroadcaster, Inc.
44
// SPDX-License-Identifier: AGPL-3.0-or-later
55

6-
require(__DIR__ . '/checker.php');
6+
/**
7+
* Database updates class.
8+
*
9+
* @package Support
10+
*/
11+
namespace OpenBroadcaster\Support;
712

8-
class OBFUpdates
13+
class Updates
914
{
1015
public function __construct($module = null)
1116
{
1217
$this->module = $module;
1318

14-
$checker = new OBFChecker($module);
15-
$checker_methods = get_class_methods('OBFChecker');
19+
$checker = new \OpenBroadcaster\Support\Checker($module);
20+
$checker_methods = get_class_methods('\\OpenBroadcaster\\Support\\Checker');
1621
$checker_methods = array_filter($checker_methods, fn($x) => $x !== '__construct');
1722
$this->checker_results = [];
1823

@@ -117,5 +122,3 @@ public function run($update)
117122
return $result;
118123
}
119124
}
120-
121-
$u = new OBFUpdates();

public/updates/index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55

66
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
77

8-
require_once(__DIR__ . '/updates.php');
8+
require_once(__DIR__ . '/../../core/support/Checker.php');
9+
require_once(__DIR__ . '/../../core/support/Updates.php');
910

1011
if (empty($_GET['run']) || $_GET['run'] != 1) {
1112
$run = false;
1213
} else {
1314
$run = true;
1415
}
1516

17+
$u = new \OpenBroadcaster\Support\Updates();
18+
1619
?>
1720
<html>
1821
<head>

0 commit comments

Comments
 (0)