Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
- php
- page
paths:
- source/compose.manager/php
- source/compose.manager/include
excludePaths:
- */vendor/*
ignoreErrors:
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</testsuites>
<source>
<include>
<directory>source/compose.manager/php</directory>
<directory>source/compose.manager/include</directory>
</include>
</source>
<coverage>
Expand Down
6 changes: 3 additions & 3 deletions source/compose.manager/Compose.page
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Cond="$var['fsState'] == 'Started' && exec('/etc/rc.d/rc.docker status | grep -v
---
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.switchbutton.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.filetree.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/styles/comboButton.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/styles/editorModal.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/sheets/ComboButton.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/sheets/EditorModal.css')?>">
<script src="<?autov('/webGui/javascript/jquery.switchbutton.js')?>"></script>
<script src="<?autov('/webGui/javascript/jquery.filetree.js')?>" charset="utf-8"></script>
<script src="<?autov('/plugins/dynamix.docker.manager/javascript/docker.js')?>"></script>
Expand All @@ -18,4 +18,4 @@ table tbody td {
line-height:normal
}
</style>
<?php include '/usr/local/emhttp/plugins/compose.manager/php/compose_manager_main.php';?>
<?php include '/usr/local/emhttp/plugins/compose.manager/include/ComposeManager.php';?>
14 changes: 7 additions & 7 deletions source/compose.manager/compose.manager.dashboard.page
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ EOT;
$script = <<<'EOT'
<script>
(function() {
var caURL = '/plugins/compose.manager/php/exec.php';
var caURL = '/plugins/compose.manager/include/Exec.php';
var expandedStacks = {};
var stackContainerCache = {};

Expand Down Expand Up @@ -294,7 +294,7 @@ $script .= <<<'EOT'
}

function stackAction(stackName, action) {
// Map dashboard action names to compose_util.php action names
// Map dashboard action names to ComposeUtil.php action names
var actionMap = {
'start': 'composeUp',
'stop': 'composeStop',
Expand All @@ -305,7 +305,7 @@ $script .= <<<'EOT'
var $status = $('#compose_stacks_status');
$status.text(actionTitle + 'ing ' + stackName + '...');

$.post('/plugins/compose.manager/php/compose_util.php', {
$.post('/plugins/compose.manager/include/ComposeUtil.php', {
action: apiAction,
path: '/boot/config/plugins/compose.manager/projects/' + stackName
}, function(data) {
Expand All @@ -324,7 +324,7 @@ $script .= <<<'EOT'
function openStackLogs(stackName) {
// Open combined logs for the stack in a new window
var projectPath = '/boot/config/plugins/compose.manager/projects/' + stackName;
$.post('/plugins/compose.manager/php/compose_util.php', {
$.post('/plugins/compose.manager/include/ComposeUtil.php', {
action: 'composeLogs',
path: projectPath
}, function(data) {
Expand Down Expand Up @@ -412,7 +412,7 @@ $script .= <<<'EOT'
function openDockerTerminal(name, isLogs, shell) {
if (isLogs) {
// Logs — start ttyd via plugin, open in new window (same as stack logs)
$.post('/plugins/compose.manager/php/compose_util.php', {
$.post('/plugins/compose.manager/include/ComposeUtil.php', {
action: 'containerLogs',
container: name
}, function(data) {
Expand All @@ -425,7 +425,7 @@ $script .= <<<'EOT'
});
} else {
// Console — start writable ttyd via plugin, open directly
$.post('/plugins/compose.manager/php/compose_util.php', {
$.post('/plugins/compose.manager/include/ComposeUtil.php', {
action: 'containerConsole',
container: name,
shell: shell || '/bin/bash'
Expand Down Expand Up @@ -542,7 +542,7 @@ $script .= <<<'EOT'
}

function loadComposeStacks() {
$.post('/plugins/compose.manager/php/dashboard_stacks.php', function(data) {
$.post('/plugins/compose.manager/include/DashboardStacks.php', function(data) {
var statusText = 'Stacks -- Started: ' + data.started + ', Stopped: ' + data.stopped;
if (data.partial > 0) statusText += ', Partial: ' + data.partial;
$('#compose_stacks_status').text(statusText);
Expand Down
6 changes: 3 additions & 3 deletions source/compose.manager/compose.manager.page
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ if (!empty($_SERVER['REQUEST_URI'])) {
}
}
?>
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/styles/comboButton.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/styles/editorModal.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/sheets/ComboButton.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/plugins/compose.manager/sheets/EditorModal.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.filetree.css')?>">
<script src="<?autov('/webGui/javascript/jquery.filetree.js')?>" charset="utf-8"></script>
<?php include '/usr/local/emhttp/plugins/compose.manager/php/compose_manager_main.php';?>
<?php include '/usr/local/emhttp/plugins/compose.manager/include/ComposeManager.php';?>
16 changes: 8 additions & 8 deletions source/compose.manager/compose.manager.settings.page
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Type="xmenu"
---
<?php
include "/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Defines.php");
$cfg = parse_plugin_cfg($sName);
$ui_patch_button_type = (!$option_patch_ui && strcmp($cfg['PATCH_UI'], "true") == 0 && !isset($composemanDockerClientPatch)) ? "Button" : "Hidden";
$ui_unpatch_button_type = (!$option_patch_ui && strcmp($cfg['PATCH_UI'], "false") == 0 && isset($composemanDockerClientPatch)) ? "Button" : "Hidden";
Expand Down Expand Up @@ -617,7 +617,7 @@ $acePath = file_exists('/usr/local/emhttp/plugins/dynamix/javascript/ace/ace.js'
</style>
<script src="<? autov('/plugins/compose.manager/javascript/common.js') ?>"></script>
<script>
var caURL = "/plugins/compose.manager/php/exec.php";
var caURL = "/plugins/compose.manager/include/Exec.php";
var skipPatchUI = <?php echo json_encode($option_patch_ui); ?>; // true when Unraid >= 6.12
var logRefreshInterval = null;
var autoScroll = true;
Expand Down Expand Up @@ -1522,10 +1522,10 @@ $acePath = file_exists('/usr/local/emhttp/plugins/dynamix/javascript/ace/ace.js'

function loadUpdatesUI() {
$('#updates-tbody').html('<tr><td colspan="5" class="compose-text-muted" style="text-align:center;padding:12px;">_(Loading stacks...)_</td></tr>');
$.post('/plugins/compose.manager/php/exec.php', {
$.post('/plugins/compose.manager/include/Exec.php', {
action: 'listProjects'
}, function(projects) {
$.post('/plugins/compose.manager/php/autoupdate.php', {
$.post('/plugins/compose.manager/include/AutoUpdate.php', {
action: 'getConfig'
}, function(cfg) {
// Response is already parsed as JSON by jQuery due to Content-Type header
Expand Down Expand Up @@ -1585,7 +1585,7 @@ $acePath = file_exists('/usr/local/emhttp/plugins/dynamix/javascript/ace/ace.js'
}

function refreshCronStatus() {
$.post('/plugins/compose.manager/php/autoupdate.php', {
$.post('/plugins/compose.manager/include/AutoUpdate.php', {
action: 'getCronStatus'
}, function(r) {
// Response is already parsed as JSON by jQuery due to Content-Type header
Expand Down Expand Up @@ -1716,7 +1716,7 @@ $acePath = file_exists('/usr/local/emhttp/plugins/dynamix/javascript/ace/ace.js'
var schedulerEnabled = $('#AUTOUPDATE_ENABLED').is(':checked');

// Save config first
$.post('/plugins/compose.manager/php/autoupdate.php', {
$.post('/plugins/compose.manager/include/AutoUpdate.php', {
action: 'saveConfig',
data: JSON.stringify(cfg)
}, function(resp) {
Expand All @@ -1728,7 +1728,7 @@ $acePath = file_exists('/usr/local/emhttp/plugins/dynamix/javascript/ace/ace.js'

// Then update scheduler
var schedulerAction = schedulerEnabled ? 'installCron' : 'removeCron';
$.post('/plugins/compose.manager/php/autoupdate.php', {
$.post('/plugins/compose.manager/include/AutoUpdate.php', {
action: schedulerAction
}, function(d) {
setUpdatesSpinner(false);
Expand Down Expand Up @@ -1770,7 +1770,7 @@ $acePath = file_exists('/usr/local/emhttp/plugins/dynamix/javascript/ace/ace.js'
return;
}
var p = paths[idx++];
$.post('/plugins/compose.manager/php/autoupdate.php', {
$.post('/plugins/compose.manager/include/AutoUpdate.php', {
action: 'runNow',
path: p
}, function(data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/php/util.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Util.php");

$action = isset($_POST['action']) ? $_POST['action'] : '';
$autofile = getAutoUpdateConfigFilePath();
Expand Down Expand Up @@ -72,7 +72,7 @@
if ($cronDirEnv !== false && $cronDirEnv !== '') {
$cronDir = $cronDirEnv;
$cronFile = rtrim($cronDir, '/') . '/compose_manager_autoupdate';
$runner = escapeshellarg($plugin_root . "php/autoupdate_runner.php");
$runner = escapeshellarg($plugin_root . "include/AutoUpdateRunner.php");
$line = "*/15 * * * * root " . escapeshellarg($phpBinary) . " " . $runner . " >/dev/null 2>&1\n";
// ensure cron directory exists for test environments
$cdir = dirname($cronFile);
Expand All @@ -86,7 +86,7 @@
} else {
// Default behavior: use plugin-owned cron file and let update_cron sync it to the system
$pluginCron = '/boot/config/plugins/compose.manager/compose.manager.cron';
$runner = escapeshellarg($plugin_root . "php/autoupdate_runner.php");
$runner = escapeshellarg($plugin_root . "include/AutoUpdateRunner.php");
$line = "*/15 * * * * root " . escapeshellarg($phpBinary) . " " . $runner . " >/dev/null 2>&1\n";

if (!is_dir(dirname($pluginCron))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* Runner invoked by cron to check autoupdate.json and run updates when scheduled
*/
require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/php/util.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Util.php");

$autofile = getAutoUpdateConfigFilePath();
if (!is_file($autofile)) exit(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* Archives are .tar.gz files containing stack directories.
*/

require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/php/util.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Util.php");

/**
* Get the backup destination path from config, falling back to default.
Expand Down Expand Up @@ -338,7 +338,7 @@ function formatBytes($bytes)

/**
* Log a message to syslog with compose.manager tag.
* Guarded to avoid redeclaration when compose_util_functions.php is also loaded.
* Guarded to avoid redeclaration when Helpers.php is also loaded.
*/
if (!function_exists('logger')) {
function logger($message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* This file is called via AJAX to load the stack list without blocking page load
*/

require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/php/util.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Util.php");

$cfg = parse_plugin_cfg($sName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* The stack list is loaded asynchronously via AJAX for better UX
*/

require_once("/usr/local/emhttp/plugins/compose.manager/php/defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/php/util.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Defines.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Util.php");

// Load plugin config
$cfg = parse_plugin_cfg($sName);
Expand Down Expand Up @@ -58,7 +58,7 @@ function compose_manager_cpu_spec_count($cpuSpec)
$cpuCount = 1;
}

// Note: Stack list is now loaded asynchronously via compose_list.php
// Note: Stack list is now loaded asynchronously via ComposeList.php
// This improves page load time by deferring expensive docker commands
?>

Expand Down Expand Up @@ -263,8 +263,8 @@ function compose_manager_cpu_spec_count($cpuSpec)
<script src="/plugins/compose.manager/javascript/common.js" type="text/javascript"></script>
<script>
var compose_root = <?php echo json_encode($compose_root); ?>;
var caURL = "/plugins/compose.manager/php/exec.php";
var compURL = "/plugins/compose.manager/php/compose_util.php";
var caURL = "/plugins/compose.manager/include/Exec.php";
var compURL = "/plugins/compose.manager/include/ComposeUtil.php";
var aceTheme = <?php echo (in_array($theme, ['black', 'gray']) ? json_encode('ace/theme/tomorrow_night') : json_encode('ace/theme/tomorrow')); ?>;
var aceBasePath = <?php echo json_encode($acePath); ?>;
const icon_label = <?php echo json_encode($docker_label_icon); ?>;
Expand Down Expand Up @@ -480,7 +480,7 @@ function composeLoadlist() {
showComposeSpinner('Loading stack list...');
}, 500);

$.get('/plugins/compose.manager/php/compose_list.php')
$.get('/plugins/compose.manager/include/ComposeList.php')
.done(function(data) {
clearTimeout(composeTimers.load);

Expand Down Expand Up @@ -657,8 +657,8 @@ function initStackListUI() {

// Load external stylesheets (non-critical styles — critical ones are inline above)
(function() {
var base = '<? autov("/plugins/compose.manager/styles/comboButton.css"); ?>';
var editor = '<? autov("/plugins/compose.manager/styles/editorModal.css"); ?>';
var base = '<? autov("/plugins/compose.manager/sheets/ComboButton.css"); ?>';
var editor = '<? autov("/plugins/compose.manager/sheets/EditorModal.css"); ?>';
if (!$('link[href="' + base + '"]').length)
$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', base));
if (!$('link[href="' + editor + '"]').length)
Expand Down Expand Up @@ -1869,7 +1869,7 @@ function renderStackAggregates() {
}

composeStackIndex.forEach(function(entry) {
// Primary: short IDs baked into the row by compose_list.php
// Primary: short IDs baked into the row by ComposeList.php
var idList = entry.containerIds.slice();

// Fallback: if the detail panel was expanded, stackContainersCache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Compose Util - AJAX Action Handler for Compose Manager
*
* Handles compose actions like up, down, pull, etc.
* Functions are defined in compose_util_functions.php for testability.
* Functions are defined in Helpers.php for testability.
*/

require_once("/usr/local/emhttp/plugins/compose.manager/php/compose_util_functions.php");
require_once("/usr/local/emhttp/plugins/compose.manager/include/Helpers.php");

$background = isset($_POST['background']) && $_POST['background'] == '1';

Expand Down Expand Up @@ -108,7 +108,7 @@
// Wait for ttyd to create the socket (up to 2s) to avoid 502
waitForTtydSocket($socketName);

echo "/plugins/compose.manager/php/show_ttyd.php?socket=" . urlencode($socketName);
echo "/plugins/compose.manager/include/ShowTtyd.php?socket=" . urlencode($socketName);
}
break;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

$plugin_root = "/usr/local/emhttp/plugins/compose.manager";

require_once("$plugin_root/php/defines.php");
require_once("$plugin_root/php/util.php");
require_once("$plugin_root/include/Defines.php");
require_once("$plugin_root/include/Util.php");

$summary = [
'total' => 0,
Expand Down
Loading
Loading