diff --git a/source/compose.manager/php/DockerUpdate.php b/source/compose.manager/php/DockerUpdate.php
new file mode 100644
index 0000000..5b225c5
--- /dev/null
+++ b/source/compose.manager/php/DockerUpdate.php
@@ -0,0 +1,62 @@
+
+
+$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
+
+define("SHELL_FORMAT", [
+ 'green' => "\033[32m",
+ 'yellow' => "\033[33m",
+ 'red' => "\033[31m",
+ 'bold' => "\033[1m",
+ 'default' => "\033[0m",
+]);
+
+$images = array();
+
+// Take stdin from compose.sh and put into images array
+$f = fopen( 'php://stdin', 'r' );
+while( $image = fgets( $f ) )
+ $images[] = trim($image);
+fclose( $f );
+$images = array_unique($images);
+
+
+echo "\nChecking for updates & updating unRaid's image version details for " . SHELL_FORMAT['bold'] . count($images) . " image(s):\n" . SHELL_FORMAT['default'];
+$DockerUpdate = new DockerUpdate();
+
+try {
+ foreach( $images as $image ) {
+ echo " - {$image}...";
+
+ // Update the local image version info
+ $localVer = $DockerUpdate->inspectLocalVersion($image);
+ $DockerUpdate->setUpdateStatus($image, $localVer);
+
+ // Update the remote version info
+ $DockerUpdate->reloadUpdateStatus($image);
+
+ // Get current update status - true=up-to-date false=update available null=data unavailable
+ $updateStatus = $DockerUpdate->getUpdateStatus($image);
+ echo ( $updateStatus==true ? SHELL_FORMAT['green']." up to date" : ( $updateStatus===null ? SHELL_FORMAT['red']." failed to get update status" : SHELL_FORMAT['yellow']." update available" ) ) . "\n" . SHELL_FORMAT['default'];
+ }
+ echo "\nunRaid image versions updated\n";
+
+} catch (Exception $err) {
+ echo SHELL_FORMAT['red']."\nUpdating unRaid's image versions failed".SHELL_FORMAT['default']."\nError: ". $err->getMessage() ."\n";
+}
+?>
\ No newline at end of file
diff --git a/source/compose.manager/php/compose_manager_main.php b/source/compose.manager/php/compose_manager_main.php
index 8d07a17..7870568 100644
--- a/source/compose.manager/php/compose_manager_main.php
+++ b/source/compose.manager/php/compose_manager_main.php
@@ -205,6 +205,7 @@ functionBefore: function(instance,helper) {
\
\
\
+ \
");
}
});
@@ -754,6 +755,19 @@ function ComposeLogs(myID) {
}
})
}
+
+function ComposeCheckUpdates(myID) {
+ var height = 800;
+ var width = 1200;
+ $("#"+myID).tooltipster("close");
+ var script = $("#"+myID).attr("data-scriptname");
+ var path = compose_root + "/" + script;
+ $.post(compURL,{action:'composeCheckUpdates',path:path},function(data) {
+ if (data) {
+ openBox(data,"Check for Available Updates to Stack "+basename(path),height,width,true);
+ }
+ })
+}
diff --git a/source/compose.manager/php/compose_util.php b/source/compose.manager/php/compose_util.php
index 84a87c5..4dcf1e7 100644
--- a/source/compose.manager/php/compose_util.php
+++ b/source/compose.manager/php/compose_util.php
@@ -132,5 +132,8 @@ function echoComposeCommand($action)
case 'composeLogs':
echoComposeCommand('logs');
break;
+ case 'composeCheckUpdates':
+ echoComposeCommand('checkUpdates');
+ break;
}
?>
\ No newline at end of file
diff --git a/source/compose.manager/scripts/compose.sh b/source/compose.manager/scripts/compose.sh
index 8219d1e..db0f2ef 100755
--- a/source/compose.manager/scripts/compose.sh
+++ b/source/compose.manager/scripts/compose.sh
@@ -1,6 +1,8 @@
#!/bin/bash
export HOME=/root
+phpScriptDir=/usr/local/emhttp/plugins/compose.manager/php
+
SHORT=e:,c:,f:,p:,d:,o:,g:
LONG=env,command:,file:,project_name:,project_dir:,override:,profile:,debug,recreate
OPTS=$(getopt -a -n compose --options $SHORT --longoptions $LONG -- "$@")
@@ -132,6 +134,9 @@ case $command in
fi
eval docker rmi ${images[*]}
fi
+
+ # Update unRaid's local/remote image versions database so GUI shows correct info about updates
+ docker compose -p "$name" ps --format "{{.Image}}" | php $phpScriptDir/DockerUpdate.php 2>&1
;;
stop)
@@ -155,6 +160,11 @@ case $command in
eval docker compose $envFile $files $options logs -f 2>&1
;;
+ checkUpdates)
+ # Update unRaid's local/remote image versions database so GUI shows correct info about updates
+ docker compose -p "$name" ps --format "{{.Image}}" | php $phpScriptDir/DockerUpdate.php 2>&1
+ ;;
+
*)
echo "unknown command"
echo $command