function gmirror_get_status_single($mirror) { $status = ""; $mirror_status = gmirror_get_status(); var_dump($mirror_status); return $mirror_status[$mirror]['status']; }
function gmirror_html_status() { $mirrors = gmirror_get_status(); $output = ""; if (count($mirrors) > 0) { $output .= "<tr>\n"; $output .= "<td width=\"40%\" class=\"vncellt\">" . gettext('Name') . "</td>\n"; $output .= "<td width=\"40%\" class=\"vncellt\">" . gettext('Status') . "</td>\n"; $output .= "<td width=\"20%\" class=\"vncellt\">" . gettext('Component') . "</td>\n"; $output .= "</tr>\n"; foreach ($mirrors as $mirror => $name) { $components = count($name["components"]); $output .= "<tr>\n"; $output .= "<td width=\"40%\" rowspan=\"{$components}\" class=\"listr\">{$name['name']}</td>\n"; $output .= "<td width=\"40%\" rowspan=\"{$components}\" class=\"listr\">{$name['status']}</td>\n"; $output .= "<td width=\"20%\" class=\"listr\">{$name['components'][0]}</td>\n"; $output .= "</tr>\n"; if (count($name["components"]) > 1) { $morecomponents = array_slice($name["components"], 1); foreach ($morecomponents as $component) { $output .= "<tr>\n"; $output .= "<td width=\"20%\" class=\"listr\">{$component}</td>\n"; $output .= "</tr>\n"; } } } } else { $output .= "<tr><td colspan=\"3\" class=\"listr\">" . gettext('No Mirrors Found') . "</td></tr>\n"; } // $output .= "<tr><td colspan=\"3\" class=\"listr\">Updated at " . date("F j, Y, g:i:s a") . "</td></tr>\n"; return $output; }
break; case "rebuild": $result = gmirror_force_rebuild($_POST['mirror'], $_POST['consumer']); break; } $redir = "Location: diag_gmirror.php"; if ($result != 0) { $redir .= "?error=" . urlencode($result); } /* If we reload the page too fast, the gmirror information may be missing or not up-to-date. */ sleep(3); header($redir); return; } } $mirror_status = gmirror_get_status(); $mirror_list = gmirror_get_mirrors(); $unused_disks = gmirror_get_disks(); $unused_consumers = array(); foreach ($unused_disks as $disk) { if (is_consumer_unused($disk)) { $unused_consumers = array_merge($unused_consumers, gmirror_get_all_unused_consumer_sizes_on_disk($disk)); } } if ($input_errors) { print_input_errors($input_errors); } if ($_GET["error"] && $_GET["error"] != 0) { print_info_box(gettext("There was an error performing the chosen mirror operation. Check the System Log for details.")); } ?>