11<?php
22
33require_once ("/usr/local/emhttp/plugins/compose.manager/php/defines.php " );
4+ require_once ("/usr/local/emhttp/plugins/dynamix/include/Wrappers.php " );
45
56function logger ($ string ) {
67 $ string = escapeshellarg ($ string );
@@ -26,29 +27,10 @@ function execComposeCommandInTTY($cmd)
2627}
2728
2829function echoComposeCommand ($ action )
29- // {
30- // global $plugin_root;
31- // $path = isset($_POST['path']) ? urldecode(($_POST['path'])) : "";
32- // $unRaidVars = parse_ini_file("/var/local/emhttp/var.ini");
33- // if ($unRaidVars['mdState'] != "STARTED" ) {
34- // echo $plugin_root."/scripts/arrayNotStarted.sh";
35- // logger("Array not Started!");
36- // }
37- // else
38- // {
39- // $projectName = basename($path);
40- // if ( is_file("$path/name") ) {
41- // $projectName = trim(file_get_contents("$path/name"));
42- // }
43- // $projectName = sanitizeStr($projectName);
44- // $path .= "/compose.yml";
45- // // exec("chmod +x ".escapeshellarg($plugin_root."/scripts/compose.sh"));
46- // $composeCommand = $plugin_root."/scripts/compose.sh"."&arg1=".$action."&arg2=".$path."&arg3=".$projectName;
47- // echo $composeCommand;
48- // }
49- // }
5030{
5131 global $ plugin_root ;
32+ global $ sName ;
33+ $ cfg = parse_plugin_cfg ($ sName );
5234 $ path = isset ($ _POST ['path ' ]) ? urldecode (($ _POST ['path ' ])) : "" ;
5335 $ unRaidVars = parse_ini_file ("/var/local/emhttp/var.ini " );
5436 if ($ unRaidVars ['mdState ' ] != "STARTED " ) {
@@ -63,12 +45,19 @@ function echoComposeCommand($action)
6345 }
6446 $ projectName = sanitizeStr ($ projectName );
6547 $ path .= "/compose.yml " ;
66- $ compose_command = join (" " , array (escapeshellarg ($ plugin_root ."scripts/compose.sh " ),escapeshellarg ($ action ),escapeshellarg ($ path ),escapeshellarg ($ projectName )));
67- logger ($ compose_command );
48+
49+ if ($ cfg ['OUTPUTSTYLE ' ] == "ttyd " ) {
50+ $ composeCommand = join (" " , array (escapeshellarg ($ plugin_root ."scripts/compose.sh " ),escapeshellarg ($ action ),escapeshellarg ($ path ),escapeshellarg ($ projectName )));
51+ execComposeCommandInTTY ($ composeCommand );
52+ logger ($ composeCommand );
53+ $ composeCommand = "/plugins/compose.manager/php/show_ttyd.php " ;
54+ }
55+ else {
56+ $ composeCommand = $ plugin_root ."/scripts/compose.sh " ."&arg1= " .$ action ."&arg2= " .$ path ."&arg3= " .$ projectName ;
57+ }
6858
69- execComposeCommandInTTY ($ compose_command );
70- echo "/plugins/compose.manager/php/show_ttyd.php " ;
71- logger ("/plugins/compose.manager/php/show_ttyd.php " );
59+ echo $ composeCommand ;
60+ logger ($ composeCommand );
7261 }
7362}
7463
0 commit comments