当前位置: 首页>>代码示例>>PHP>>正文


PHP mwexec2函数代码示例

本文整理汇总了PHP中mwexec2函数的典型用法代码示例。如果您正苦于以下问题:PHP mwexec2函数的具体用法?PHP mwexec2怎么用?PHP mwexec2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mwexec2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: zfs_dataset_display_properties

function zfs_dataset_display_properties()
{
    mwexec2("zfs list -H -o name -t filesystem 2>&1", $rawdata);
    $vols = implode(" ", $rawdata);
    mwexec2("zfs get all {$vols} 2>&1", $rawdata2);
    return implode("\n", $rawdata2);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:7,代码来源:disks_zfs_dataset_info.php

示例2: zfs_volume_display_properties

function zfs_volume_display_properties()
{
    mwexec2("zfs list -H -o name -t volume 2>&1", $rawdata);
    $vols = implode(" ", $rawdata);
    mwexec2("zfs get all {$vols} 2>&1", $rawdata2);
    return implode("\n", $rawdata2);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:7,代码来源:disks_zfs_volume_info.php

示例3: get_zfs_snapshots

function get_zfs_snapshots()
{
    $result = array();
    mwexec2("zfs list -H -o name,used,creation -t snapshot 2>&1", $rawdata);
    foreach ($rawdata as $line) {
        $a = preg_split("/\t/", $line);
        $r = array();
        $name = $a[0];
        $r['snapshot'] = $name;
        if (preg_match('/^([^\\/\\@]+)(\\/([^\\@]+))?\\@(.*)$/', $name, $m)) {
            $r['pool'] = $m[1];
            $r['name'] = $m[4];
            $r['path'] = $m[1] . $m[2];
        } else {
            $r['pool'] = 'unknown';
            // XXX
            $r['name'] = 'unknown';
            // XXX
            $r['path'] = $name;
        }
        $r['used'] = $a[1];
        $r['creation'] = $a[2];
        $result[] = $r;
    }
    return $result;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:26,代码来源:disks_zfs_snapshot.php

示例4: get_all_hast

function get_all_hast()
{
    $a = array();
    $a[''] = gettext("Must choose one");
    mwexec2("hastctl dump | grep resource", $rawdata);
    foreach ($rawdata as $line) {
        $hast = preg_split("/\\s/", $line);
        $name = $hast[1];
        $file = "/dev/hast/{$name}";
        if (file_exists($file)) {
            $diskinfo = disks_get_diskinfo($file);
            $size = $diskinfo[mediasize_mbytes];
            if ($size > 1024) {
                $size = (int) ($size / 1024);
                $size .= "GB";
            } else {
                $size .= "MB";
            }
        } else {
            $size = "(secondary)";
        }
        $a[$file] = htmlspecialchars("{$name}: {$size}");
    }
    return $a;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:25,代码来源:disks_mount_edit.php

示例5: zfs_snapshot_display_properties

function zfs_snapshot_display_properties()
{
    mwexec2("zfs list -H -o name -t snapshot 2>&1", $rawdata);
    $snaps = implode(" ", $rawdata);
    $rawdata2 = array();
    if (!empty($snaps)) {
        mwexec2("zfs get all {$snaps} 2>&1", $rawdata2);
    }
    return implode("\n", $rawdata2);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:10,代码来源:disks_zfs_snapshot_info.php

示例6: zfs_zpool_get_iostat

function zfs_zpool_get_iostat()
{
    // Get zpool I/O statistic informations
    $cmd = "zpool iostat -v 2>&1";
    if (isset($_GET['pool'])) {
        $cmd .= " {$_GET['pool']}";
    }
    mwexec2($cmd, $rawdata);
    return implode("\n", $rawdata);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:10,代码来源:disks_zfs_zpool_io.php

示例7: hast_get_status

function hast_get_status()
{
    global $config;
    if (!isset($config['hast']['enable'])) {
        return gettext("HAST disabled");
    }
    $cmd = "/sbin/hastctl status";
    if (isset($_GET['name'])) {
        $cmd .= " {$_GET['name']}";
    }
    $cmd .= " 2>&1";
    mwexec2($cmd, $rawdata);
    return implode("\n", $rawdata);
}
开发者ID:sdoney,项目名称:nas4free,代码行数:14,代码来源:services_hast_info.php

示例8: zfs_zpool_get_status

function zfs_zpool_get_status()
{
    global $config;
    array_sort_key($config['zfs']['pools']['pool'], "name");
    array_sort_key($config['zfs']['vdevices']['vdevice'], "name");
    $a_pool = $config['zfs']['pools']['pool'];
    $a_vdevice = $config['zfs']['vdevices']['vdevice'];
    // Get zpool status informations
    $cmd = "zpool status -v";
    if (isset($_GET['pool'])) {
        $cmd .= " {$_GET['pool']}";
    }
    mwexec2($cmd, $rawdata);
    return implode("\n", $rawdata);
}
开发者ID:rterbush,项目名称:nas4free,代码行数:15,代码来源:disks_zfs_zpool_info.php

示例9: ismounted_or_dataset

function ismounted_or_dataset($path)
{
    if (disks_ismounted_ex($path, "mp")) {
        return true;
    }
    mwexec2("/sbin/zfs list -H -o mountpoint", $rawdata);
    foreach ($rawdata as $line) {
        $mp = trim($line);
        if ($mp == "-") {
            conitnue;
        }
        if ($path == $mp) {
            return true;
        }
    }
    return false;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:17,代码来源:services_nfs_share_edit.php

示例10: get_zfs_paths

function get_zfs_paths()
{
    $result = array();
    mwexec2("zfs list -H -o name -t filesystem,volume 2>&1", $rawdata);
    foreach ($rawdata as $line) {
        $a = preg_split("/\t/", $line);
        $r = array();
        $name = $a[0];
        $r['path'] = $name;
        if (preg_match('/^([^\\/\\@]+)(\\/([^\\@]+))?$/', $name, $m)) {
            $r['pool'] = $m[1];
        } else {
            $r['pool'] = 'unknown';
            // XXX
        }
        $result[] = $r;
    }
    return $result;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:19,代码来源:disks_zfs_snapshot_add.php

示例11: rcconf_process_updatenotification

function rcconf_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            if (is_array($config['system']['rcconf']['param'])) {
                $index = array_search_ex($data, $config['system']['rcconf']['param'], "uuid");
                if (false !== $index) {
                    mwexec2("/usr/local/sbin/rconf attribute remove {$config['system']['rcconf']['param'][$index]['name']}");
                    unset($config['system']['rcconf']['param'][$index]);
                    write_config();
                }
            }
            break;
    }
    return $retval;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:21,代码来源:system_rcconf.php

示例12: get_mount_info

function get_mount_info($path)
{
    if (file_exists($path) === FALSE) {
        return FALSE;
    }
    // get all mount points
    $a_mounts = array();
    mwexec2('/sbin/mount -p', $rawdata);
    foreach ($rawdata as $line) {
        list($dev, $dir, $fs, $opt, $dump, $pass) = preg_split('/\\s+/', $line);
        $a_mounts[] = array('dev' => $dev, 'dir' => $dir, 'fs' => $fs, 'opt' => $opt, 'dump' => $dump, 'pass' => $pass);
    }
    if (empty($a_mounts)) {
        return FALSE;
    }
    // check path with mount list
    do {
        foreach ($a_mounts as $mountv) {
            if (strcmp($mountv['dir'], $path) == 0) {
                // found mount point
                return $mountv;
            }
        }
        // path don't have parent?
        if (strpos($path, '/') === FALSE) {
            break;
        }
        // retry with parent
        $pathinfo = pathinfo($path);
        $path = $pathinfo['dirname'];
    } while (1);
    return FALSE;
}
开发者ID:BillTheBest,项目名称:OpenNAS,代码行数:33,代码来源:services_samba_share_edit.php

示例13: get_all_hast

function get_all_hast($a_extent, $uuid)
{
    $a = array();
    $a[''] = gettext("Must choose one");
    mwexec2("hastctl dump | grep resource", $rawdata);
    foreach ($rawdata as $line) {
        $hast = preg_split("/\\s/", $line);
        $name = $hast[1];
        $file = "/dev/hast/{$name}";
        if (file_exists($file)) {
            $diskinfo = disks_get_diskinfo($file);
            $size = $diskinfo[mediasize_mbytes];
            if ($size > 1024) {
                $size = (int) ($size / 1024);
                $size .= "GB";
            } else {
                $size .= "MB";
            }
        } else {
            $size = "(secondary)";
        }
        $index = array_search_ex($file, $a_extent, "path");
        if (FALSE !== $index) {
            if (!isset($uuid)) {
                continue;
            }
            if ($a_extent[$index]['uuid'] != $uuid) {
                continue;
            }
        }
        $a[$file] = htmlspecialchars("{$name}: {$size}");
    }
    return $a;
}
开发者ID:rterbush,项目名称:nas4free,代码行数:34,代码来源:services_iscsitarget_extent_edit.php

示例14: execCmd

function execCmd($cmd)
{
    mwexec2("{$cmd} 2>&1", $output, $status);
    return implode("\n", $output);
}
开发者ID:BillTheBest,项目名称:OpenNAS,代码行数:5,代码来源:hast_alerts.php

示例15: unset

    if (is_array($config['bhyve'])) {
        unset($config['bhyve']);
        write_config();
        header("Location: /");
        exit;
    }
} elseif (!is_file("/tmp/bhyve.install")) {
    unlink_if_exists("/tmp/extensions_bhyve_config.php");
    $connected = @fsockopen("www.github.com", 80);
    if ($connected) {
        fclose($connected);
        unset($gitconfigfile);
        $gitconfigfile = file_get_contents("https://raw.githubusercontent.com/alexey1234/vmbhyve_nas4free/master/conf/ext/extensions_bhyve_config.php");
        $git_ver = preg_split("/bhyve_VERSION,/", $gitconfigfile);
        $git_ver = 0 + $git_ver[1];
        mwexec2("fetch -o /tmp/install.sh https://raw.githubusercontent.com/alexey1234/vmbhyve_nas4free/master/bhyve_install.sh", $garbage, $fetch_ret_val);
        if (is_file("/tmp/install.sh")) {
            // Fetch of install.sh succeeded
            mwexec("chmod a+x /tmp/install.sh");
        } else {
            $input_errors[] = "There seems to be a networking issue. I can't reach GitHub to retrieve the file. <br />Please check <a href='/system.php'>DNS</a> and other <a href='/interfaces_lan.php'>networking settings</a>. <br />Alternatively, try it again to see if there was some transient network problem.";
        }
        // end of failed install.sh fetch
    }
    // end of successful internet connectivity test
}
out:
include "fbegin.inc";
?>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
开发者ID:alexey1234,项目名称:vmbhyve_nas4free,代码行数:31,代码来源:extensions_bhyve_config.php


注:本文中的mwexec2函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。