below
Better caching, under certain circumstances, items could show as being installed.pull/11/head
parent
e7636cf0e3
commit
9554ff42d5
Binary file not shown.
|
@ -2,8 +2,8 @@
|
|||
83b3f89cd42e8601c7c217d5b4889c81 ./CA_notices.page
|
||||
7ee0b23dbd92ed55f611360a983f9565 ./ca_settings.page
|
||||
1b49ec9797713ce869ea0c1066a109f2 ./default.cfg
|
||||
68687732848bc95c5520aada3a5093b1 ./include/exec.php
|
||||
3fddb80cc00d46ff551e9ff42c70ba73 ./include/helpers.php
|
||||
b07cd3f62c0daad5a62cbb75847819c6 ./include/exec.php
|
||||
aee2d4e715238cef7938587ec497ad20 ./include/helpers.php
|
||||
aeec70878e94eead3aef390110e786e8 ./include/paths.php
|
||||
eb76c1b6ed3da5e5b393f22d2ec18430 ./javascript/libraries.js
|
||||
8c24d585c7dd3ff9ef961bb2c2705711 ./PluginAPI.page
|
||||
|
@ -22,4 +22,4 @@ b398273cf7daa62ab00d2de2336ca25f ./README.md
|
|||
2bd671daecaf01549f8cc0202cb184b3 ./scripts/updatePluginSupport.php
|
||||
62fa68c6f6a42cdb79dd0d60b5f8a3f6 ./skins/Narrow/css.php
|
||||
4ff34c148d3dde1a420303faecd414ae ./skins/Narrow/skin.html
|
||||
70e950bafb5c84f4f4566c3e62d84988 ./skins/Narrow/skin.php
|
||||
fd5492300079650cac45773b5b8ba15d ./skins/Narrow/skin.php
|
||||
|
|
|
@ -962,8 +962,8 @@ function previous_apps() {
|
|||
|
||||
$installed = getPost("installed","");
|
||||
$filter = getPost("filter","");
|
||||
// $info = $caSettings['dockerRunning'] ? $DockerClient->getDockerContainers() : array();
|
||||
$info = $caSettings['dockerRunning'] ? readJsonFile($caPaths['info']) : array();
|
||||
$info = getAllInfo();
|
||||
|
||||
@unlink($caPaths['community-templates-allSearchResults']);
|
||||
@unlink($caPaths['community-templates-catSearchResults']);
|
||||
@unlink($caPaths['repositoriesDisplayed']);
|
||||
|
@ -1205,8 +1205,9 @@ function uninstall_docker() {
|
|||
$DockerClient->removeContainer($containerName,$dockerRunning[$container]['Id']);
|
||||
$DockerClient->removeImage($dockerRunning[$container]['ImageId']);
|
||||
|
||||
$info = $caSettings['dockerRunning'] ? $DockerClient->getDockerContainers() : array();
|
||||
writeJsonFile($caPaths['info'],$info);
|
||||
// $info = $caSettings['dockerRunning'] ? $DockerClient->getDockerContainers() : array();
|
||||
$info = getAllInfo(true);
|
||||
// writeJsonFile($caPaths['info'],$info);
|
||||
|
||||
postReturn(['status'=>"Uninstalled"]);
|
||||
}
|
||||
|
@ -1613,18 +1614,7 @@ function get_categories() {
|
|||
}
|
||||
}
|
||||
}
|
||||
// $info = $caSettings['dockerRunning'] ? $DockerClient->getDockerContainers() : array();
|
||||
if ( $caSettings['dockerRunning'] ) {
|
||||
$info = $DockerTemplates->getAllInfo(false,true,true);
|
||||
# workaround for incorrect caching in dockerMan
|
||||
$containers = $DockerClient->getDockerContainers();
|
||||
foreach ($containers as &$container) {
|
||||
$container['running'] = $info[$container['Name']]['running'];
|
||||
$container['url'] = $info[$container['Name']]['url'];
|
||||
}
|
||||
}
|
||||
|
||||
writeJsonFile($caPaths['info'],$containers);
|
||||
getAllInfo(true);
|
||||
postReturn(["categories"=>$cat]);
|
||||
}
|
||||
|
||||
|
|
|
@ -626,6 +626,30 @@ function write_ini_file($file,$array) {
|
|||
file_put_contents($file,implode("\r\n", $res),LOCK_EX);
|
||||
}
|
||||
|
||||
###################################################
|
||||
# Gets all the information about what's installed #
|
||||
###################################################
|
||||
function getAllInfo($force=false) {
|
||||
global $caSettings, $DockerTemplates, $DockerClient, $caPaths;
|
||||
|
||||
$containers = [];
|
||||
if ( $force ) {
|
||||
if ( $caSettings['dockerRunning'] ) {
|
||||
$info = $DockerTemplates->getAllInfo(false,true,true);
|
||||
$containers = $DockerClient->getDockerContainers();
|
||||
foreach ($containers as &$container) {
|
||||
$container['running'] = $info[$container['Name']]['running'];
|
||||
$container['url'] = $info[$container['Name']]['url'];
|
||||
$container['template'] = $info[$container['Name']]['template'];
|
||||
}
|
||||
}
|
||||
writeJsonFile($caPaths['info'],$containers);
|
||||
} else {
|
||||
$containers = readJsonFile($caPaths['info']);
|
||||
}
|
||||
return $containers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @copyright Copyright 2006-2012, Miles Johnson - http://milesj.me
|
||||
* @license http://opensource.org/licenses/mit-license.php - Licensed under the MIT License
|
||||
|
|
|
@ -35,13 +35,13 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
|||
if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) {
|
||||
$caSettings['dockerRunning'] = "true";
|
||||
// $info = $DockerTemplates->getAllInfo();
|
||||
$info = readJsonFile($caPaths['info']);
|
||||
$dockerRunning = $DockerClient->getDockerContainers();
|
||||
$info = getAllInfo();
|
||||
//$dockerRunning = $DockerClient->getDockerContainers();
|
||||
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
|
||||
} else {
|
||||
unset($caSettings['dockerRunning']);
|
||||
$info = array();
|
||||
$dockerRunning = array();
|
||||
// $dockerRunning = array();
|
||||
$dockerUpdateStatus = array();
|
||||
}
|
||||
|
||||
|
@ -95,15 +95,14 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
|||
$ct .= displayCard($template);
|
||||
$count++;
|
||||
if ( $count == $caSettings['maxPerPage'] ) break;
|
||||
} else {
|
||||
|
||||
|
||||
} else {
|
||||
$actionsContext = [];
|
||||
$selected = false;
|
||||
if ( ! $template['Language'] ) {
|
||||
if ( ! $template['NoInstall'] && ! $caSettings['NoInstalls']) {
|
||||
if ( ! $template['Plugin'] ) {
|
||||
if ( $caSettings['dockerRunning'] ) {
|
||||
foreach ($dockerRunning as $testDocker) {
|
||||
foreach ($info as $testDocker) {
|
||||
if ( ($template['Repository'] == $testDocker['Image'] || "{$template['Repository']}:latest" == $testDocker['Image']) && ($template['Name'] == $testDocker['Name']) ) {
|
||||
$selected = true;
|
||||
$name = $testDocker['Name'];
|
||||
|
@ -127,9 +126,9 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
|||
else
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','second');");
|
||||
}
|
||||
$actionsContext[] = array("icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$name]['template'])."','edit');");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$ind]['template'])."','edit');");
|
||||
$actionsContext[] = array("divider"=>true);
|
||||
$actionsContext[] = array("icon"=>"ca_fa-delete","text"=>tr("Uninstall"),"action"=>"uninstallDocker('".addslashes($info[$name]['template'])."','{$template['Name']}');");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-delete","text"=>tr("Uninstall"),"action"=>"uninstallDocker('".addslashes($info[$ind]['template'])."','{$template['Name']}');");
|
||||
|
||||
} elseif ( ! $template['Blacklist'] || ! $template['Compatible']) {
|
||||
if ( $template['InstallPath'] ) {
|
||||
|
@ -223,9 +222,8 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
|||
if ( ! strpos($tmpRepo,"/") ) {
|
||||
$tmpRepo = "library/$tmpRepo";
|
||||
}
|
||||
foreach ($dockerRunning as $testDocker) {
|
||||
foreach ($info as $testDocker) {
|
||||
if ( ($tmpRepo == $testDocker['Image'] || "$tmpRepo:latest" == $testDocker['Image']) && ($template['Name'] == $testDocker['Name']) ) {
|
||||
// $template['Installed'] = ! $template['Uninstall']; // Stops the Installed flag from appearing within Installed apps
|
||||
$template['Installed'] = true;
|
||||
|
||||
break;
|
||||
|
@ -311,7 +309,7 @@ function getPageNavigation($pageNumber,$totalApps,$dockerSearch,$displayCount =
|
|||
# Generate the display for the popup #
|
||||
######################################
|
||||
function getPopupDescriptionSkin($appNumber) {
|
||||
global $caSettings, $caPaths, $language;
|
||||
global $caSettings, $caPaths, $language, $DockerTemplates, $DockerClient;
|
||||
|
||||
$unRaidVars = parse_ini_file($caPaths['unRaidVars']);
|
||||
$dockerVars = parse_ini_file($caPaths['docker_cfg']);
|
||||
|
@ -323,9 +321,7 @@ function getPopupDescriptionSkin($appNumber) {
|
|||
|
||||
if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) {
|
||||
$caSettings['dockerRunning'] = "true";
|
||||
$DockerTemplates = new DockerTemplates();
|
||||
$DockerClient = new DockerClient();
|
||||
$info = $DockerTemplates->getAllInfo();
|
||||
$info = getAllInfo();
|
||||
$dockerRunning = $DockerClient->getDockerContainers();
|
||||
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue