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


PHP DiskDevice::setOptions方法代码示例

本文整理汇总了PHP中DiskDevice::setOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP DiskDevice::setOptions方法的具体用法?PHP DiskDevice::setOptions怎么用?PHP DiskDevice::setOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DiskDevice的用法示例。


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

示例1: df


//.........这里部分代码省略.........
                 continue;
             }
             if (preg_match("/(.*)(\\s+)(([0-9]+)(\\s+)([0-9]+)(\\s+)([\\-0-9]+)(\\s+)([0-9]+)\$)/", $df_buf1[0], $df_buf2)) {
                 if (count($df_buf1) == 3) {
                     $df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[2]);
                 } else {
                     $df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[1]);
                 }
                 if (count($df_buf) == 6) {
                     $df_buf[5] = trim($df_buf[5]);
                     $dev = new DiskDevice();
                     $dev->setName(trim($df_buf[0]));
                     if ($df_buf[2] < 0) {
                         $dev->setTotal($df_buf[3] * 1024);
                         $dev->setUsed($df_buf[3] * 1024);
                     } else {
                         $dev->setTotal($df_buf[1] * 1024);
                         $dev->setUsed($df_buf[2] * 1024);
                         if ($df_buf[3] > 0) {
                             $dev->setFree($df_buf[3] * 1024);
                         }
                     }
                     if (PSI_SHOW_MOUNT_POINT) {
                         $dev->setMountPoint($df_buf[5]);
                     }
                     $notwas = true;
                     if (isset($mount_parm)) {
                         foreach ($mount_parm as $mount_param) {
                             //name and mountpoint find
                             if ($mount_param['name'] === trim($df_buf[0]) && $mount_param['mountpoint'] === $df_buf[5]) {
                                 $dev->setFsType($mount_param['fstype']);
                                 if (PSI_SHOW_MOUNT_OPTION) {
                                     if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                         $dev->setOptions($mount_param['options']);
                                     } else {
                                         $mpo = $mount_param['options'];
                                         $mpo = preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
                                         $mpo = preg_replace('/,guest,/i', ',', $mpo);
                                         $mpo = preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
                                         $mpo = preg_replace('/,user=[^,]*,/i', ',', $mpo);
                                         $mpo = preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
                                         $mpo = preg_replace('/,username=[^,]*,/i', ',', $mpo);
                                         $mpo = preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
                                         $mpo = preg_replace('/,password=[^,]*,/i', ',', $mpo);
                                         $dev->setOptions($mpo);
                                     }
                                 }
                                 $notwas = false;
                                 break;
                             }
                         }
                         if ($notwas) {
                             foreach ($mount_parm as $mount_param) {
                                 //mountpoint find
                                 if ($mount_param['mountpoint'] === $df_buf[5]) {
                                     $dev->setFsType($mount_param['fstype']);
                                     if (PSI_SHOW_MOUNT_OPTION) {
                                         if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                             $dev->setOptions($mount_param['options']);
                                         } else {
                                             $mpo = $mount_param['options'];
                                             $mpo = preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
                                             $mpo = preg_replace('/,guest,/i', ',', $mpo);
                                             $mpo = preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
                                             $mpo = preg_replace('/,user=[^,]*,/i', ',', $mpo);
                                             $mpo = preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
开发者ID:phpsysinfo,项目名称:phpsysinfo,代码行数:67,代码来源:class.Parser.inc.php

示例2: _filesystems

 /**
  * filesystem information
  *
  * @return void
  */
 private function _filesystems()
 {
     $arrResult = array();
     if (CommonFunctions::executeProgram('df', '-b', $df, PSI_DEBUG)) {
         $df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
         foreach ($df as $df_line) {
             $ar_buf = preg_split("/\\s+/", $df_line);
             if (substr($df_line, 0, 1) == "/" && count($ar_buf) == 6) {
                 $dev = new DiskDevice();
                 $dev->setMountPoint($ar_buf[0]);
                 $dev->setName($ar_buf[5]);
                 $dev->setFsType($ar_buf[1]);
                 $dev->setOptions($ar_buf[4]);
                 $dev->setTotal($ar_buf[2] * 1024);
                 $dev->setFree($ar_buf[3] * 1024);
                 $dev->setUsed($dev->getTotal() - $dev->getFree());
                 $this->sys->setDiskDevices($dev);
             }
         }
     }
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:26,代码来源:class.Haiku.inc.php

示例3: _filesystems

 /**
  * filesystem information
  *
  * @return void
  */
 private function _filesystems()
 {
     if (CommonFunctions::executeProgram('df', '2>/dev/null ', $df, PSI_DEBUG)) {
         $df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
         if (CommonFunctions::executeProgram('mount', '', $mount, PSI_DEBUG)) {
             $mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
             foreach ($mount as $mount_line) {
                 $mount_buf = preg_split('/\\s+/', $mount_line);
                 if (count($mount_buf) == 6) {
                     $mount_parm[$mount_buf[1]]['fstype'] = $mount_buf[2];
                     if (PSI_SHOW_MOUNT_OPTION) {
                         $mount_parm[$mount_buf[1]]['options'] = $mount_buf[3];
                     }
                     $mount_parm[$mount_buf[1]]['mountdev'] = $mount_buf[0];
                 }
             }
             foreach ($df as $df_line) {
                 if ((preg_match("/^(\\/\\S+)(\\s+)(([0-9\\.]+)([KMGT])(\\s+)([0-9\\.]+)([KMGT])(\\s+)([0-9\\.]+)([KMGT])(\\s+))/", $df_line, $df_buf) || preg_match("/^(\\/[^\\s\\:]+)\\:(\\s+)(([0-9\\.]+)([KMGT])(\\s+total\\,\\s+)([0-9\\.]+)([KMGT])(\\s+used\\,\\s+)([0-9\\.]+)([KMGT])(\\s+available))/", $df_line, $df_buf)) && !preg_match('/^\\/mnt\\/asec\\/com\\./', $df_buf[1])) {
                     $dev = new DiskDevice();
                     if (PSI_SHOW_MOUNT_POINT) {
                         $dev->setMountPoint($df_buf[1]);
                     }
                     if ($df_buf[5] == 'K') {
                         $dev->setTotal($df_buf[4] * 1024);
                     } elseif ($df_buf[5] == 'M') {
                         $dev->setTotal($df_buf[4] * 1024 * 1024);
                     } elseif ($df_buf[5] == 'G') {
                         $dev->setTotal($df_buf[4] * 1024 * 1024 * 1024);
                     } elseif ($df_buf[5] == 'T') {
                         $dev->setTotal($df_buf[4] * 1024 * 1024 * 1024 * 1024);
                     }
                     if ($df_buf[8] == 'K') {
                         $dev->setUsed($df_buf[7] * 1024);
                     } elseif ($df_buf[8] == 'M') {
                         $dev->setUsed($df_buf[7] * 1024 * 1024);
                     } elseif ($df_buf[8] == 'G') {
                         $dev->setUsed($df_buf[7] * 1024 * 1024 * 1024);
                     } elseif ($df_buf[8] == 'T') {
                         $dev->setUsed($df_buf[7] * 1024 * 1024 * 1024 * 1024);
                     }
                     if ($df_buf[11] == 'K') {
                         $dev->setFree($df_buf[10] * 1024);
                     } elseif ($df_buf[11] == 'M') {
                         $dev->setFree($df_buf[10] * 1024 * 1024);
                     } elseif ($df_buf[11] == 'G') {
                         $dev->setFree($df_buf[10] * 1024 * 1024 * 1024);
                     } elseif ($df_buf[11] == 'T') {
                         $dev->setFree($df_buf[10] * 1024 * 1024 * 1024 * 1024);
                     }
                     if (isset($mount_parm[$df_buf[1]])) {
                         $dev->setFsType($mount_parm[$df_buf[1]]['fstype']);
                         $dev->setName($mount_parm[$df_buf[1]]['mountdev']);
                         if (PSI_SHOW_MOUNT_OPTION) {
                             if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                 $dev->setOptions($mount_parm[$df_buf[1]]['options']);
                             } else {
                                 $mpo = $mount_parm[$df_buf[1]]['options'];
                                 $mpo = preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
                                 $mpo = preg_replace('/,guest,/i', ',', $mpo);
                                 $mpo = preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
                                 $mpo = preg_replace('/,user=[^,]*,/i', ',', $mpo);
                                 $mpo = preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
                                 $mpo = preg_replace('/,username=[^,]*,/i', ',', $mpo);
                                 $mpo = preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
                                 $mpo = preg_replace('/,password=[^,]*,/i', ',', $mpo);
                                 $dev->setOptions($mpo);
                             }
                         }
                     }
                     $this->sys->setDiskDevices($dev);
                 }
             }
         }
     }
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:80,代码来源:class.Android.inc.php

示例4: df

 /**
  * parsing the output of df command
  *
  * @param string $df_param additional parameter for df command
  *
  * @return array
  */
 public static function df($df_param = "")
 {
     $arrResult = array();
     if (CommonFunctions::executeProgram('df', '-k ' . $df_param, $df, PSI_DEBUG)) {
         $df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
         if (PSI_SHOW_INODES) {
             if (CommonFunctions::executeProgram('df', '-i ' . $df_param, $df2, PSI_DEBUG)) {
                 $df2 = preg_split("/\n/", $df2, -1, PREG_SPLIT_NO_EMPTY);
                 // Store inode use% in an associative array (df_inodes) for later use
                 foreach ($df2 as $df2_line) {
                     if (preg_match("/^(\\S+).*\\s([0-9]+)%/", $df2_line, $inode_buf)) {
                         $df_inodes[$inode_buf[1]] = $inode_buf[2];
                     }
                 }
             }
         }
         if (CommonFunctions::executeProgram('mount', '', $mount, PSI_DEBUG)) {
             $mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
             foreach ($mount as $mount_line) {
                 if (preg_match("/\\S+ on (\\S+) type (.*) \\((.*)\\)/", $mount_line, $mount_buf)) {
                     $mount_parm[$mount_buf[1]]['fstype'] = $mount_buf[2];
                     $mount_parm[$mount_buf[1]]['options'] = $mount_buf[3];
                 } elseif (preg_match("/\\S+ (.*) on (\\S+) \\((.*)\\)/", $mount_line, $mount_buf)) {
                     $mount_parm[$mount_buf[2]]['fstype'] = $mount_buf[1];
                     $mount_parm[$mount_buf[2]]['options'] = $mount_buf[3];
                 } elseif (preg_match("/\\S+ on (\\S+) \\((\\S+)(,\\s(.*))?\\)/", $mount_line, $mount_buf)) {
                     $mount_parm[$mount_buf[1]]['fstype'] = $mount_buf[2];
                     $mount_parm[$mount_buf[1]]['options'] = isset($mount_buf[4]) ? $mount_buf[4] : '';
                 }
             }
             foreach ($df as $df_line) {
                 $df_buf1 = preg_split("/(\\%\\s)/", $df_line, 2);
                 if (count($df_buf1) != 2) {
                     continue;
                 }
                 preg_match("/(.*)(\\s+)(([0-9]+)(\\s+)([0-9]+)(\\s+)([0-9]+)(\\s+)([0-9]+)\$)/", $df_buf1[0], $df_buf2);
                 $df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[1]);
                 if (count($df_buf) == 6) {
                     $df_buf[5] = trim($df_buf[5]);
                     $dev = new DiskDevice();
                     $dev->setName(trim($df_buf[0]));
                     if ($df_buf[2] < 0) {
                         $dev->setTotal($df_buf[3] * 1024);
                         $dev->setUsed($df_buf[3] * 1024);
                     } else {
                         $dev->setTotal($df_buf[1] * 1024);
                         $dev->setUsed($df_buf[2] * 1024);
                         $dev->setFree($df_buf[3] * 1024);
                     }
                     $dev->setMountPoint($df_buf[5]);
                     $dev->setFsType($mount_parm[$df_buf[5]]['fstype']);
                     $dev->setOptions($mount_parm[$df_buf[5]]['options']);
                     if (PSI_SHOW_INODES && isset($df_inodes[trim($df_buf[0])])) {
                         $dev->setPercentInodesUsed($df_inodes[trim($df_buf[0])]);
                     }
                     $arrResult[] = $dev;
                 }
             }
         }
     }
     return $arrResult;
 }
开发者ID:jhbsz,项目名称:ossimTest,代码行数:69,代码来源:class.Parser.inc.php

示例5: df

 /**
  * parsing the output of df command
  *
  * @param string $df_param additional parameter for df command
  *
  * @return array
  */
 public static function df($df_param = "")
 {
     $arrResult = array();
     if (CommonFunctions::executeProgram('df', '-k ' . $df_param, $df, PSI_DEBUG)) {
         $df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
         if (PSI_SHOW_INODES) {
             if (CommonFunctions::executeProgram('df', '-i ' . $df_param, $df2, PSI_DEBUG)) {
                 $df2 = preg_split("/\n/", $df2, -1, PREG_SPLIT_NO_EMPTY);
                 // Store inode use% in an associative array (df_inodes) for later use
                 foreach ($df2 as $df2_line) {
                     if (preg_match("/^(\\S+).*\\s([0-9]+)%/", $df2_line, $inode_buf)) {
                         $df_inodes[$inode_buf[1]] = $inode_buf[2];
                     }
                 }
             }
         }
         if (CommonFunctions::executeProgram('mount', '', $mount, PSI_DEBUG)) {
             $mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
             foreach ($mount as $mount_line) {
                 if (preg_match("/\\S+ on (\\S+) type (.*) \\((.*)\\)/", $mount_line, $mount_buf)) {
                     $mount_parm[$mount_buf[1]]['fstype'] = $mount_buf[2];
                     if (PSI_SHOW_MOUNT_OPTION) {
                         $mount_parm[$mount_buf[1]]['options'] = $mount_buf[3];
                     }
                 } elseif (preg_match("/\\S+ is (.*) mounted on (\\S+) \\(type (.*)\\)/", $mount_line, $mount_buf)) {
                     $mount_parm[$mount_buf[2]]['fstype'] = $mount_buf[3];
                     if (PSI_SHOW_MOUNT_OPTION) {
                         $mount_parm[$mount_buf[2]]['options'] = $mount_buf[1];
                     }
                 } elseif (preg_match("/\\S+ (.*) on (\\S+) \\((.*)\\)/", $mount_line, $mount_buf)) {
                     $mount_parm[$mount_buf[2]]['fstype'] = $mount_buf[1];
                     if (PSI_SHOW_MOUNT_OPTION) {
                         $mount_parm[$mount_buf[2]]['options'] = $mount_buf[3];
                     }
                 } elseif (preg_match("/\\S+ on ([\\S ]+) \\((\\S+)(,\\s(.*))?\\)/", $mount_line, $mount_buf)) {
                     $mount_parm[$mount_buf[1]]['fstype'] = $mount_buf[2];
                     if (PSI_SHOW_MOUNT_OPTION) {
                         $mount_parm[$mount_buf[1]]['options'] = isset($mount_buf[4]) ? $mount_buf[4] : '';
                     }
                 }
             }
             foreach ($df as $df_line) {
                 $df_buf1 = preg_split("/(\\%\\s)/", $df_line, 3);
                 if (count($df_buf1) < 2) {
                     continue;
                 }
                 if (preg_match("/(.*)(\\s+)(([0-9]+)(\\s+)([0-9]+)(\\s+)([\\-0-9]+)(\\s+)([0-9]+)\$)/", $df_buf1[0], $df_buf2)) {
                     if (count($df_buf1) == 3) {
                         $df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[2]);
                     } else {
                         $df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[1]);
                     }
                     if (count($df_buf) == 6) {
                         $df_buf[5] = trim($df_buf[5]);
                         $dev = new DiskDevice();
                         $dev->setName(trim($df_buf[0]));
                         if ($df_buf[2] < 0) {
                             $dev->setTotal($df_buf[3] * 1024);
                             $dev->setUsed($df_buf[3] * 1024);
                         } else {
                             $dev->setTotal($df_buf[1] * 1024);
                             $dev->setUsed($df_buf[2] * 1024);
                             if ($df_buf[3] > 0) {
                                 $dev->setFree($df_buf[3] * 1024);
                             }
                         }
                         if (PSI_SHOW_MOUNT_POINT) {
                             $dev->setMountPoint($df_buf[5]);
                         }
                         if (isset($mount_parm[$df_buf[5]])) {
                             $dev->setFsType($mount_parm[$df_buf[5]]['fstype']);
                             if (PSI_SHOW_MOUNT_OPTION) {
                                 if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                     $dev->setOptions($mount_parm[$df_buf[5]]['options']);
                                 } else {
                                     $mpo = $mount_parm[$df_buf[5]]['options'];
                                     $mpo = preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
                                     $mpo = preg_replace('/,guest,/i', ',', $mpo);
                                     $mpo = preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
                                     $mpo = preg_replace('/,user=[^,]*,/i', ',', $mpo);
                                     $mpo = preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
                                     $mpo = preg_replace('/,username=[^,]*,/i', ',', $mpo);
                                     $mpo = preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
                                     $mpo = preg_replace('/,password=[^,]*,/i', ',', $mpo);
                                     $dev->setOptions($mpo);
                                 }
                             }
                         }
                         if (PSI_SHOW_INODES && isset($df_inodes[trim($df_buf[0])])) {
                             $dev->setPercentInodesUsed($df_inodes[trim($df_buf[0])]);
                         }
                         $arrResult[] = $dev;
                     }
//.........这里部分代码省略.........
开发者ID:HaakonME,项目名称:porticoestate,代码行数:101,代码来源:class.Parser.inc.php


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