Ready to test on 6.9.2
parent
634101b81c
commit
6762125cce
Binary file not shown.
|
@ -272,6 +272,7 @@ $(function(){
|
|||
|
||||
$('.mainArea').on("click",".dockerUpdate",function() {
|
||||
var container = $(this).attr("data-name");
|
||||
$("#sb-nav-close").css("visibility","hidden"); // Because docker install cannot be aborted so why allow window to close
|
||||
<? if ( $translations ): ?>
|
||||
openBox('/plugins/community.applications/scripts/installUpdate.php?ct[]='+encodeURIComponent(container),tr('Update Container'),600,1100,true,"refreshDisplay");
|
||||
<? else: ?>
|
||||
|
|
|
@ -8,6 +8,8 @@ Link='nav-user'
|
|||
# Licenced under GPLv2 #
|
||||
# #
|
||||
###############################################################
|
||||
|
||||
### Note: This file is only needed on OS versions less than 6.8.3
|
||||
?>
|
||||
|
||||
<? if ( ! file_exists("/usr/local/emhttp/plugins/dynamix.plugin.manager/PluginHelpers.page") ) : ?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
767d6f2203fed9541daeb57bbf7b58b3 ./Apps.page
|
||||
83b3f89cd42e8601c7c217d5b4889c81 ./CA_notices.page
|
||||
fcf7fdd6e4091b8b495d1f44f751a8b1 ./CommunityApps.page
|
||||
6db73582f22dab13d329e862067ee84e ./PluginAPI.page
|
||||
c310bec9668efd9bb040c2854f0b0ad8 ./CommunityApps.page
|
||||
8c24d585c7dd3ff9ef961bb2c2705711 ./PluginAPI.page
|
||||
b398273cf7daa62ab00d2de2336ca25f ./README.md
|
||||
2cdb7da0d67a11278ada7fd029707738 ./ca_settings.page
|
||||
7c88ace586933a4a60b0ef2f8a97a662 ./default.cfg
|
||||
|
@ -19,7 +19,7 @@ e29c13353bc1277fc2c3597782d7c954 ./skins/Narrow/css.php
|
|||
e7bf62923b2d7109b6848554701e12f6 ./skins/Narrow/skin.html
|
||||
3d99868bae55191e2fe27bfcb3b8806e ./skins/Narrow/skin.php
|
||||
430966e5646376b62905b63a30de7102 ./scripts/PluginAPI.php
|
||||
11eecc7264a3057ee70cc00a24c8299b ./scripts/installMulti.php
|
||||
bbd9dec6c5df486d75c46388c14f09ce ./scripts/installMulti.php
|
||||
ce2c904b6a40c4677a3ff3484776959e ./scripts/installMultiPlugin.sh
|
||||
524afab04ca930f59117a846f819fb2f ./scripts/installPluginUpdate.sh
|
||||
5846421e95b475e1156c3f68164ccc4f ./scripts/languageInstall.sh
|
||||
|
@ -28,5 +28,5 @@ ce2c904b6a40c4677a3ff3484776959e ./scripts/installMultiPlugin.sh
|
|||
f9c3f431935fb20801f3fef152dc7b58 ./scripts/showStatistics.php
|
||||
4425f8fd4ef662a7dc65cee01de3e419 ./scripts/updatePLG.sh
|
||||
02759ea835ee4ce5a051fead96ab9b9b ./scripts/updatePluginSupport.php
|
||||
0a4b291ae29b73cea0437a11ba28c8d9 ./scripts/checkForUpdates.php
|
||||
090480fd4d6f2dff82f0b5c3e8ca3e6a ./scripts/checkForUpdates.php
|
||||
ce77df69331ccd3bf4037389325a01e1 ./scripts/installUpdate.php
|
||||
|
|
|
@ -10,7 +10,7 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: "/usr/local/emhttp";
|
|||
exec("$docroot/plugins/dynamix.docker.manager/scripts/dockerupdate check nonotify > /dev/null 2>&1");
|
||||
foreach (glob("/var/log/plugins/*.plg") as $plg) {
|
||||
if ( $plg == "/var/log/plugins/community.applications.plg" || $plg == "unRAIDServer.plg" || $plg == "gui.search.plg")
|
||||
continue; // avoid possible race condition since CA / gui.search automatically check for updates for themselves
|
||||
continue; // avoid possible race condition since CA / gui.search automatically check for updates for themselves when on Apps tab
|
||||
|
||||
exec("$docroot/plugins/dynamix.plugin.manager/scripts/plugin check ".escapeshellarg(basename($plg))." > /dev/null 2>&1");
|
||||
}
|
||||
|
|
|
@ -14,37 +14,47 @@ if ( $translations ) {
|
|||
|
||||
require_once "$docroot/plugins/community.applications/include/paths.php";
|
||||
require_once "$docroot/plugins/dynamix/include/Wrappers.php";
|
||||
require_once "$docroot/plugins/community.applications/include/helpers.php";
|
||||
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
|
||||
|
||||
$caSettings['dockerRunning'] = true;
|
||||
$unRaidVersion = parse_ini_file($caPaths['unRaidVersion']);
|
||||
$translations = is_file("$docroot/plugins/dynamix/include/Translations.php");
|
||||
|
||||
$DockerClient = new DockerClient();
|
||||
$DockerTemplates = new DockerTemplates();
|
||||
function tr($string,$ret=true) {
|
||||
if ( function_exists("_") )
|
||||
$string = str_replace('"',""",str_replace("'","'",_($string)));
|
||||
if ( $ret )
|
||||
return $string;
|
||||
else
|
||||
echo $string;
|
||||
}
|
||||
|
||||
$running = getRunningContainers();
|
||||
function startsWith($haystack, $needle) {
|
||||
return $needle === "" || strripos($haystack, $needle, -strlen($haystack)) !== FALSE;
|
||||
}
|
||||
|
||||
$exeFile = "/usr/local/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php";
|
||||
# Modify the system file to avoid a harmless error from being displayed under normal circumstances
|
||||
# Not needed under unRaid 6.6.2+
|
||||
|
||||
if ( version_compare($unRaidVersion['version'],"6.6.2",">=") ) {
|
||||
$exeFile = "/usr/local/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php";
|
||||
} else {
|
||||
$exeFile = "/tmp/community.applications/tempFiles/newCreateDocker.php";
|
||||
$dockerInstall = file("/usr/local/emhttp/plugins/dynamix.docker.manager/include/CreateDocker.php",FILE_IGNORE_NEW_LINES);
|
||||
foreach ($dockerInstall as $line) {
|
||||
if ( startsWith(trim($line),"removeContainer(") ) {
|
||||
$line = "#$line";
|
||||
}
|
||||
$newInstall[] = $line;
|
||||
}
|
||||
file_put_contents($exeFile,implode("\n",$newInstall));
|
||||
chmod($exeFile,0777);
|
||||
}
|
||||
$javascript = file_get_contents("/usr/local/emhttp/plugins/dynamix/javascript/dynamix.js");
|
||||
echo "<script>$javascript</script>";
|
||||
|
||||
$dockers = explode(",",$_GET['docker']);
|
||||
if ( $_GET['upgrade'] ) {
|
||||
foreach ( $dockers as $container ) {
|
||||
if ( $running[$container]['running'] ) {
|
||||
echo "Stopping $container...\n";
|
||||
myStopContainer($running[$container]['Id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $_GET['docker'] ) {
|
||||
echo "<div id='output'>";
|
||||
|
||||
$msg = $_GET['upgrade'] ? "Upgrading docker application %s" : "Installing docker applications %s";
|
||||
echo sprintf(tr($msg),str_replace(",",", ",$_GET['docker']))."<br>";
|
||||
$dockers = explode(",",$_GET['docker']);
|
||||
echo sprintf(tr("Installing docker applications %s"),str_replace(",",", ",$_GET['docker']))."<br>";
|
||||
$_GET['updateContainer'] = true;
|
||||
$_GET['ct'] = $dockers;
|
||||
$_GET['communityApplications'] = true;
|
||||
|
@ -87,50 +97,38 @@ function addCloseButton() {
|
|||
}
|
||||
</script>
|
||||
<?
|
||||
if ( ! $_GET['upgrade'] ) {
|
||||
foreach ($dockers as $docker) {
|
||||
echo sprintf(tr("Starting %s"),"<span class='ca_bold'>$docker</span>")."<br>";
|
||||
unset($output);
|
||||
exec("docker start $docker 2>&1",$output,$retval);
|
||||
if ($retval) {
|
||||
$failFlag = true;
|
||||
echo sprintf(tr("%s failed to start. You should install it by itself to fix the errors"),"<span class='ca_bold'>$docker</span>")."<br>";
|
||||
foreach ($output as $line) {
|
||||
echo "<tt>$line</tt><br>";
|
||||
}
|
||||
echo "<br>";
|
||||
foreach ($dockers as $docker) {
|
||||
echo sprintf(tr("Starting %s"),"<span class='ca_bold'>$docker</span>")."<br>";
|
||||
unset($output);
|
||||
exec("docker start $docker 2>&1",$output,$retval);
|
||||
if ($retval) {
|
||||
$failFlag = true;
|
||||
echo sprintf(tr("%s failed to start. You should install it by itself to fix the errors"),"<span class='ca_bold'>$docker</span>")."<br>";
|
||||
foreach ($output as $line) {
|
||||
echo "<tt>$line</tt><br>";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
echo "<br>".tr("Setting installed applications to autostart")."<br>";
|
||||
$autostartFile = @file("/var/lib/docker/unraid-autostart",FILE_IGNORE_NEW_LINES);
|
||||
if ( ! $autostartFile ) {
|
||||
$autostartFile = array();
|
||||
}
|
||||
foreach ($autostartFile as $line) {
|
||||
$autostart[$line] = true;
|
||||
}
|
||||
foreach ($dockers as $docker) {
|
||||
$autostart[$docker] = true;
|
||||
}
|
||||
$autostartFile = implode("\n",array_keys($autostart));
|
||||
file_put_contents("/var/lib/docker/unraid-autostart",$autostartFile);
|
||||
}
|
||||
echo "<br>".tr("Setting installed applications to autostart")."<br>";
|
||||
$autostartFile = @file("/var/lib/docker/unraid-autostart",FILE_IGNORE_NEW_LINES);
|
||||
if ( ! $autostartFile ) {
|
||||
$autostartFile = array();
|
||||
}
|
||||
foreach ($autostartFile as $line) {
|
||||
$autostart[$line] = true;
|
||||
}
|
||||
foreach ($dockers as $docker) {
|
||||
$autostart[$docker] = true;
|
||||
}
|
||||
$autostartFile = implode("\n",array_keys($autostart));
|
||||
file_put_contents("/var/lib/docker/unraid-autostart",$autostartFile);
|
||||
|
||||
if ( $failFlag || !$_GET['plugin']) {
|
||||
echo "<br>".tr("Docker Application Installation finished")."<br><script>addCloseButton();</script>";
|
||||
} else {
|
||||
echo "<script>top.Shadowbox.close();</script>";
|
||||
}
|
||||
@unlink("/tmp/community.applications/tempFiles/newCreateDocker.php");
|
||||
} else {
|
||||
foreach ( $dockers as $container ) {
|
||||
if ( $running[$container]['running'] ) {
|
||||
echo "Starting $container";
|
||||
passthru("docker start $container");
|
||||
}
|
||||
}
|
||||
if ( $failFlag || !$_GET['plugin']) {
|
||||
echo "<br>".tr("Docker Application Installation finished")."<br><script>addCloseButton();</script>";
|
||||
} else {
|
||||
echo "<script>top.Shadowbox.close();</script>";
|
||||
}
|
||||
|
||||
@unlink("/tmp/community.applications/tempFiles/newCreateDocker.php");
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue