<?php 
if ($do_action && !$errormsg) {
    echo sprintf("<div id='cmdoutput'>%s</div>", gettext("Command output:"));
    echo '<pre class="cmdoutput">';
    ob_end_flush();
    $index = array_search_ex($uuid, $config['mounts']['mount'], "uuid");
    if (false !== $index) {
        $mount = $config['mounts']['mount'][$index];
        switch ($action) {
            case "mount":
                echo gettext("Mounting...") . "<br />";
                $result = disks_mount($mount);
                break;
            case "umount":
                echo gettext("Unmounting...") . "<br />";
                $result = disks_umount($mount);
                break;
        }
        echo 0 == $result ? gettext("Done.") : gettext("Failed.");
    }
    echo '</pre>';
}
?>
				<div id="remarks">
					<?php 
html_remark("note", gettext("Note"), gettext("You can't unmount a drive which is used by swap file, a iSCSI-target file or any other running process!"));
?>
				</div>
				<?php 
include "formend.inc";
?>
Пример #2
0
function mountmanagement_process_updatenotification($mode, $data)
{
    global $config;
    if (!is_array($config['mounts']['mount'])) {
        return 1;
    }
    $index = array_search_ex($data, $config['mounts']['mount'], "uuid");
    if (false === $index) {
        return 1;
    }
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
            disks_mount($config['mounts']['mount'][$index]);
            break;
        case UPDATENOTIFY_MODE_MODIFIED:
            disks_umount_ex($config['mounts']['mount'][$index]);
            disks_mount($config['mounts']['mount'][$index]);
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            disks_umount($config['mounts']['mount'][$index]);
            unset($config['mounts']['mount'][$index]);
            write_config();
            break;
    }
}