Merge pull request #520 from Squidly271/dockerIcon

dockerMan: Redownload Icon if URL changes
This commit is contained in:
tom mortensen
2019-09-27 09:46:41 -07:00
committed by GitHub
4 changed files with 26 additions and 11 deletions

View File

@@ -85,6 +85,17 @@ if (isset($_POST['contName'])) {
if (!is_dir($userTmplDir)) mkdir($userTmplDir, 0777, true);
if ($Name) {
$filename = sprintf('%s/my-%s.xml', $userTmplDir, $Name);
if ( is_file($filename) ) {
$oldXML = simplexml_load_file($filename);
if ($oldXML->Icon != $_POST['contIcon']) {
if (! strpos($Repository,":")) {
$Repository .= ":latest";
}
$iconPath = $DockerTemplates->getIcon($Repository);
@unlink("$docroot/$iconPath");
@unlink("{$dockerManPaths['images']}/".basename($iconPath));
}
}
file_put_contents($filename, $postXML);
}
// Run dry
@@ -137,7 +148,8 @@ if (isset($_POST['contName'])) {
}
if ($startContainer) $cmd = str_replace('/docker create ', '/docker run -d ', $cmd);
execCommand($cmd);
echo '<div style="text-align:center"><button type="button" onclick="done()">Done</button></div><br>';
echo '<div style="text-align:center"><button type="button" onclick="done()">Done</button></div><br>';
goto END;
}
@@ -371,11 +383,11 @@ button[type=button]{margin:0 20px 0 0}
}
return newConfig.prop('outerHTML');
}
function escapeQuote(string) {
return string.replace(new RegExp('"','g'),"&quot;");
}
function makeAllocations(container,current) {
var html = [];
for (var i=0,ct; ct=container[i]; i++) {