faster handling of installed apps section
parent
c524b66e4d
commit
47fd32efea
Binary file not shown.
|
@ -11,7 +11,7 @@ a9d4cd0e4e1f37cbe3806b952a96ddb1 ./ca_settings.page
|
||||||
6e48a62b91bdd066f023f46c6b491afd ./images/discord-gray.svg
|
6e48a62b91bdd066f023f46c6b491afd ./images/discord-gray.svg
|
||||||
8e7dc33512b8a78f28d7179a972c7c34 ./images/discord-hover.svg
|
8e7dc33512b8a78f28d7179a972c7c34 ./images/discord-hover.svg
|
||||||
54e46db492ddb033dfeb2827c5efd4a8 ./images/discord-white.svg
|
54e46db492ddb033dfeb2827c5efd4a8 ./images/discord-white.svg
|
||||||
80bdc89e71ffd5432cef6c8b46714a38 ./include/exec.php
|
4d3820a53990726e15e02929d86899ae ./include/exec.php
|
||||||
d7f50413cbaac1c6cb9ceaaef48f270a ./include/helpers.php
|
d7f50413cbaac1c6cb9ceaaef48f270a ./include/helpers.php
|
||||||
8f1129e0cdb994c6d1900192252433d8 ./include/paths.php
|
8f1129e0cdb994c6d1900192252433d8 ./include/paths.php
|
||||||
eb76c1b6ed3da5e5b393f22d2ec18430 ./javascript/libraries.js
|
eb76c1b6ed3da5e5b393f22d2ec18430 ./javascript/libraries.js
|
||||||
|
|
|
@ -1009,145 +1009,121 @@ function previous_apps() {
|
||||||
# $info contains all installed containers
|
# $info contains all installed containers
|
||||||
# now correlate that to a template;
|
# now correlate that to a template;
|
||||||
# this section handles containers that have not been renamed from the appfeed
|
# this section handles containers that have not been renamed from the appfeed
|
||||||
if ( $caSettings['dockerRunning'] ) {
|
if ( $caSettings['dockerRunning'] ) {
|
||||||
$all_files = glob("{$caPaths['dockerManTemplates']}/*.xml");
|
$all_files = glob("{$caPaths['dockerManTemplates']}/*.xml");
|
||||||
$all_files = $all_files ?: array();
|
$all_files = $all_files ?: array();
|
||||||
if ( $installed == "true" ) {
|
if ( $installed == "true" ) {
|
||||||
if ( !$filter || $filter == "docker" ) {
|
if ( !$filter || $filter == "docker" ) {
|
||||||
foreach ($info as $installedDocker) {
|
foreach ($all_files as $xmlfile) {
|
||||||
$installedName = $installedDocker['Name'];
|
$o = readXmlFile($xmlfile);
|
||||||
$installedImage = $installedDocker['Image'];
|
$o['Description'] = fixDescription($o['Description']);
|
||||||
if ( startsWith($installedImage,"library/") ) # official images are in DockerClient as library/mysql eg but template just shows mysql
|
$o['Overview'] = fixDescription($o['Overview']);
|
||||||
$installedImage = str_replace("library/","",$installedImage);
|
$o['InstallPath'] = $xmlfile;
|
||||||
|
$o['UnknownCompatible'] = true;
|
||||||
|
|
||||||
foreach ($file as &$template) {
|
$flag = false;
|
||||||
if ( $template['BranchID'] ) continue;
|
$containerID = false;
|
||||||
if ( $template['Blacklist'] ) continue;
|
foreach ($file as $templateDocker) {
|
||||||
if ( $installedName == $template['Name'] ) {
|
if ( $templateDocker['testrepo'] ) continue;
|
||||||
if ( startsWith($installedImage,$template['Repository']) ) {
|
# use startsWith to eliminate any version tags (:latest)
|
||||||
$template['Uninstall'] = true;
|
if ( startsWith($templateDocker['Repository'], $testRepo) ) {
|
||||||
$template['InstallPath'] = $template['Path'];
|
if ( $templateDocker['Name'] == $o['Name'] ) {
|
||||||
if ( $dockerUpdateStatus[$installedImage]['status'] == "false" || $dockerUpdateStatus[$template['Name']] == "false" ) {
|
$flag = true;
|
||||||
$template['UpdateAvailable'] = true;
|
$containerID = $template['ID'];
|
||||||
}
|
|
||||||
$template['testrepo'] = $installedImage;
|
|
||||||
$displayed[] = $template;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# handle renamed containers
|
|
||||||
foreach ($all_files as $xmlfile) {
|
|
||||||
$o = readXmlFile($xmlfile);
|
|
||||||
$o['Description'] = fixDescription($o['Description']);
|
|
||||||
$o['Overview'] = fixDescription($o['Overview']);
|
|
||||||
$o['InstallPath'] = $xmlfile;
|
|
||||||
$o['UnknownCompatible'] = true;
|
|
||||||
|
|
||||||
$flag = false;
|
|
||||||
$containerID = false;
|
|
||||||
foreach ($file as $templateDocker) {
|
|
||||||
if ( $templateDocker['testrepo'] ) continue;
|
|
||||||
# use startsWith to eliminate any version tags (:latest)
|
|
||||||
if ( startsWith($templateDocker['Repository'], $testRepo) ) {
|
|
||||||
if ( $templateDocker['Name'] == $o['Name'] ) {
|
|
||||||
$flag = true;
|
|
||||||
$containerID = $template['ID'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( ! $flag ) {
|
|
||||||
$runningflag = false;
|
|
||||||
foreach ($info as $installedDocker) {
|
|
||||||
$installedImage = $installedDocker['Image'];
|
|
||||||
$installedName = $installedDocker['Name'];
|
|
||||||
if ( startsWith($installedImage, $o['Repository']) ) {
|
|
||||||
if ( $installedName == $o['Name'] ) {
|
|
||||||
$runningflag = true;
|
|
||||||
$searchResult = searchArray($file,'Repository',$o['Repository']);
|
|
||||||
if ( ! $searchResult ) {
|
|
||||||
$searchResult = searchArray($file,'Repository',explode(":",$o['Repository'])[0]);
|
|
||||||
}
|
|
||||||
if ( $searchResult !== false ) {
|
|
||||||
$tempPath = $o['InstallPath'];
|
|
||||||
$containerID = $file[$searchResult]['ID'];
|
|
||||||
$o = $file[$searchResult];
|
|
||||||
$o['Name'] = $installedName;
|
|
||||||
$o['InstallPath'] = $tempPath;
|
|
||||||
$o['SortName'] = str_replace("-"," ",$installedName);
|
|
||||||
if ( $dockerUpdateStatus[$installedImage]['status'] == "false" || $dockerUpdateStatus[$template['Name']] == "false" ) {
|
|
||||||
$o['UpdateAvailable'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $runningflag ) {
|
if ( ! $flag ) {
|
||||||
$o['Uninstall'] = true;
|
$runningflag = false;
|
||||||
$o['ID'] = $containerID;
|
foreach ($info as $installedDocker) {
|
||||||
if ( $o['Blacklist'] ) continue;
|
$installedImage = $installedDocker['Image'];
|
||||||
|
$installedName = $installedDocker['Name'];
|
||||||
|
if ( startsWith($installedImage, $o['Repository']) ) {
|
||||||
|
if ( $installedName == $o['Name'] ) {
|
||||||
|
$runningflag = true;
|
||||||
|
$searchResult = searchArray($file,'Repository',$o['Repository']);
|
||||||
|
if ( ! $searchResult ) {
|
||||||
|
$searchResult = searchArray($file,'Repository',explode(":",$o['Repository'])[0]);
|
||||||
|
}
|
||||||
|
if ( $searchResult !== false ) {
|
||||||
|
$tempPath = $o['InstallPath'];
|
||||||
|
$containerID = $file[$searchResult]['ID'];
|
||||||
|
$o = $file[$searchResult];
|
||||||
|
$o['Name'] = $installedName;
|
||||||
|
$o['InstallPath'] = $tempPath;
|
||||||
|
$o['SortName'] = str_replace("-"," ",$installedName);
|
||||||
|
if ( $dockerUpdateStatus[$installedImage]['status'] == "false" || $dockerUpdateStatus[$template['Name']] == "false" ) {
|
||||||
|
$o['UpdateAvailable'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $runningflag ) {
|
||||||
|
$o['Uninstall'] = true;
|
||||||
|
$o['ID'] = $containerID;
|
||||||
|
if ( $o['Blacklist'] ) continue;
|
||||||
|
|
||||||
# handle a PR from LT where it is possible for an identical template (xml) to be present twice, with different filenames.
|
# handle a PR from LT where it is possible for an identical template (xml) to be present twice, with different filenames.
|
||||||
# Without this, an app could appear to be shown in installed apps twice
|
# Without this, an app could appear to be shown in installed apps twice
|
||||||
$fat32Fix[$searchResult]++;
|
$fat32Fix[$searchResult]++;
|
||||||
if ($fat32Fix[$searchResult] > 1) continue;
|
if ($fat32Fix[$searchResult] > 1) continue;
|
||||||
if ($o['testrepo']) continue;
|
if ($o['testrepo']) continue;
|
||||||
$displayed[] = $o;
|
$displayed[] = $o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
if ( ! $filter || $filter == "docker" ) {
|
||||||
if ( ! $filter || $filter == "docker" ) {
|
# now get the old not installed docker apps
|
||||||
# now get the old not installed docker apps
|
foreach ($all_files as $xmlfile) {
|
||||||
foreach ($all_files as $xmlfile) {
|
$o = readXmlFile($xmlfile);
|
||||||
$o = readXmlFile($xmlfile);
|
if ( ! $o ) continue;
|
||||||
if ( ! $o ) continue;
|
$o['Description'] = fixDescription($o['Description']);
|
||||||
$o['Description'] = fixDescription($o['Description']);
|
$o['Overview'] = fixDescription($o['Overview']);
|
||||||
$o['Overview'] = fixDescription($o['Overview']);
|
$o['InstallPath'] = $xmlfile;
|
||||||
$o['InstallPath'] = $xmlfile;
|
$o['UnknownCompatible'] = true;
|
||||||
$o['UnknownCompatible'] = true;
|
$o['Removable'] = true;
|
||||||
$o['Removable'] = true;
|
# is the container running?
|
||||||
# is the container running?
|
|
||||||
|
|
||||||
$flag = false;
|
$flag = false;
|
||||||
foreach ($info as $installedDocker) {
|
foreach ($info as $installedDocker) {
|
||||||
$installedImage = $installedDocker['Image'];
|
$installedImage = $installedDocker['Image'];
|
||||||
$installedImage = str_replace("library/","",$installedImage);
|
$installedImage = str_replace("library/","",$installedImage);
|
||||||
$installedName = $installedDocker['Name'];
|
$installedName = $installedDocker['Name'];
|
||||||
if ( startsWith($installedImage, $o['Repository']) ) {
|
if ( startsWith($installedImage, $o['Repository']) ) {
|
||||||
if ( $installedName == $o['Name'] ) {
|
if ( $installedName == $o['Name'] ) {
|
||||||
$flag = true;
|
$flag = true;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if ( ! $flag ) {
|
||||||
if ( ! $flag ) {
|
$testRepo = explode(":",$o['Repository'])[0];
|
||||||
$testRepo = explode(":",$o['Repository'])[0];
|
# now associate the template back to a template in the appfeed
|
||||||
# now associate the template back to a template in the appfeed
|
foreach ($file as $appTemplate) {
|
||||||
foreach ($file as $appTemplate) {
|
if (startsWith($appTemplate['Repository'],$testRepo)) {
|
||||||
if (startsWith($appTemplate['Repository'],$testRepo)) {
|
$tempPath = $o['InstallPath'];
|
||||||
$tempPath = $o['InstallPath'];
|
$tempName = $o['Name'];
|
||||||
$tempName = $o['Name'];
|
$o = $appTemplate;
|
||||||
$o = $appTemplate;
|
$o['Removable'] = true;
|
||||||
$o['Removable'] = true;
|
$o['InstallPath'] = $tempPath;
|
||||||
$o['InstallPath'] = $tempPath;
|
$o['Name'] = $tempName;
|
||||||
$o['Name'] = $tempName;
|
$o['SortName'] = str_replace("-"," ",$o['Name']);
|
||||||
$o['SortName'] = str_replace("-"," ",$o['Name']);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! $o['Blacklist'] )
|
if ( ! $o['Blacklist'] )
|
||||||
$displayed[] = $o;
|
$displayed[] = $o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
# Now work on plugins
|
# Now work on plugins
|
||||||
if ( $installed == "true" ) {
|
if ( $installed == "true" ) {
|
||||||
if ( ! $filter || $filter == "plugins" ) {
|
if ( ! $filter || $filter == "plugins" ) {
|
||||||
|
|
Loading…
Reference in New Issue