public function getAllInfo($reload = FALSE){ global $dockerManPaths; $DockerClient = new DockerClient(); $DockerUpdate = new DockerUpdate(); $new_info = array(); $dockerIni = $dockerManPaths['webui-info']; if (! is_dir( dirname( $dockerIni ))) @mkdir( dirname( $dockerIni ), 0770, true); $info = (is_file($dockerIni)) ? json_decode(file_get_contents($dockerIni), TRUE) : array(); if (! count($info) ) $info = array(); $containers = $DockerClient->getDockerContainers(); if (! count($containers) ) $containers = array(); $autostart_file = $dockerManPaths['autostart-file']; $allAutoStart = @file($autostart_file, FILE_IGNORE_NEW_LINES); if ($allAutoStart===FALSE) $allAutoStart = array(); $update_file = $dockerManPaths['update-status']; $updateStatus = (is_file($update_file)) ? json_decode(file_get_contents($update_file), TRUE) : array(); foreach ($containers as $ct) { $name = $ct['Name']; $image = $ct['Image']; $tmp = ( count($info[$name]) ) ? $info[$name] : array() ; $tmp['running'] = $ct['Running']; $tmp['autostart'] = in_array($name, $allAutoStart); $img = $this->getBannerIcon( $image ); $tmp['banner'] = ( $img['banner'] ) ? $img['banner'] : "#"; $tmp['icon'] = ( $img['icon'] ) ? $img['icon'] : "#"; $WebUI = $this->getControlURL($name); $tmp['url'] = ($WebUI) ? $WebUI : "#"; $Registry = $this->getTemplateValue($image, "Registry"); $tmp['registry'] = ( $Registry ) ? $Registry : "#"; if ($reload) { $nv = $DockerUpdate->getUpdateStatus($name, $image); if ($nv != 'undef'){ $updateStatus[$name] = $nv; } } $tmp['updated'] = (array_key_exists($name, $updateStatus)) ? $updateStatus[$name] : 'undef'; $tmp['template'] = $this->getUserTemplate($name); $this->debug("\n$name");foreach ($tmp as $c => $d) $this->debug(sprintf(" %-10s: %s", $c, $d)); $new_info[$name] = $tmp; } file_put_contents($dockerIni, json_encode($new_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); if($reload) { foreach ($updateStatus as $ct => $update) if (!isset($new_info[$ct])) unset($updateStatus[$ct]); file_put_contents($update_file, json_encode($updateStatus, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); } return $new_info; }