mirror of
https://github.com/unraid/webgui.git
synced 2026-05-03 16:29:45 -05:00
Remove duplicated code
This commit is contained in:
@@ -85,17 +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));
|
||||
}
|
||||
}
|
||||
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
|
||||
@@ -148,14 +148,7 @@ if (isset($_POST['contName'])) {
|
||||
}
|
||||
if ($startContainer) $cmd = str_replace('/docker create ', '/docker run -d ', $cmd);
|
||||
execCommand($cmd);
|
||||
if ( $newIcon ) {
|
||||
if (! strpos($Repository,":")) {
|
||||
$Repository .= ":latest";
|
||||
}
|
||||
$iconPath = $DockerTemplates->getIcon($Repository);
|
||||
@unlink("$docroot/$iconPath");
|
||||
@unlink("{$dockerManPaths['images']}/".basename($iconPath));
|
||||
}
|
||||
|
||||
echo '<div style="text-align:center"><button type="button" onclick="done()">Done</button></div><br>';
|
||||
goto END;
|
||||
}
|
||||
@@ -390,11 +383,11 @@ button[type=button]{margin:0 20px 0 0}
|
||||
}
|
||||
return newConfig.prop('outerHTML');
|
||||
}
|
||||
|
||||
|
||||
function escapeQuote(string) {
|
||||
return string.replace(new RegExp('"','g'),""");
|
||||
}
|
||||
|
||||
|
||||
function makeAllocations(container,current) {
|
||||
var html = [];
|
||||
for (var i=0,ct; ct=container[i]; i++) {
|
||||
|
||||
Reference in New Issue
Block a user