} if (!isset($check)) { echo " Updating templates... "; $docker->downloadTemplates(); echo " Updating info... "; $docker->getAllInfo(true); echo " Done."; } else { require_once("/usr/local/emhttp/webGui/include/Wrappers.php"); $client = new DockerClient(); $update = new DockerUpdate(); $notify = "/usr/local/emhttp/webGui/scripts/notify"; $unraid = parse_plugin_cfg("dynamix",true); $server = strtoupper($var['NAME']); $output = $unraid['notify']['docker_notify']; $list = $client->getDockerContainers(); $info = $docker->getAllInfo(); foreach ($list as $ct) { $name = $ct['Name']; $image = $ct['Image']; if ($info[$name]['updated'] == "false") { $new = $update->getRemoteVersion($docker->getTemplateValue($image, "Registry"), $image); exec("$notify -e 'Docker - $name [$new]' -s 'Notice [$server] - Docker update $new' -d 'A new version of $name is available' -i 'normal $output' -x"); } } } exit(0); ?>
continue; } $doc = new DOMDocument('1.0', 'utf-8'); $doc->preserveWhiteSpace = false; $doc->load( $tmpl ); $doc->formatOutput = TRUE; $Repository = $doc->getElementsByTagName( "Repository" )->item(0)->nodeValue; $Registry = $doc->getElementsByTagName( "Registry" )->item(0)->nodeValue; readfile("/usr/local/emhttp/plugins/dynamix.docker.manager/log.htm"); echo "<script>addLog('<p>Preparing to update: " . $Repository . "</p>');</script>"; @flush(); $CurrentVersion = $DockerUpdate->getRemoteVersion($Registry, $Repository); if ($CurrentVersion){ if ( $doc->getElementsByTagName( "Version" )->length == 0 ) { $root = $doc->getElementsByTagName( "Container" )->item(0); $Version = $root->appendChild($doc->createElement('Version')); } else { $Version = $doc->getElementsByTagName( "Version" )->item(0); } $Version->nodeValue = $CurrentVersion; file_put_contents($tmpl, $doc->saveXML()); } $oldContainerID = $DockerClient->getImageID($Repository); list($cmd, $Name, $Repository) = xmlToCommand($doc->saveXML());