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


PHP Parser::df方法代码示例

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


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

示例1: filesystems

 /**
  * filesystem information
  *
  * @return void
  */
 protected function filesystems()
 {
     $arrResult = Parser::df();
     foreach ($arrResult as $dev) {
         $this->sys->setDiskDevices($dev);
     }
 }
开发者ID:jhbsz,项目名称:ossimTest,代码行数:12,代码来源:class.BSDCommon.inc.php

示例2: _filesystems

 /**
  * filesystem information
  *
  * @return void
  */
 private function _filesystems()
 {
     $df_args = "";
     $hideFstypes = array();
     if (defined('PSI_HIDE_FS_TYPES') && is_string(PSI_HIDE_FS_TYPES)) {
         if (preg_match(ARRAY_EXP, PSI_HIDE_FS_TYPES)) {
             $hideFstypes = eval(PSI_HIDE_FS_TYPES);
         } else {
             $hideFstypes = array(PSI_HIDE_FS_TYPES);
         }
     }
     foreach ($hideFstypes as $Fstype) {
         $df_args .= "-x {$Fstype} ";
     }
     if ($df_args !== "") {
         $df_args = trim($df_args);
         //trim spaces
         $arrResult = Parser::df("-P {$df_args} 2>/dev/null");
     } else {
         $arrResult = Parser::df("-P 2>/dev/null");
     }
     foreach ($arrResult as $dev) {
         $this->sys->setDiskDevices($dev);
     }
 }
开发者ID:winstol2y,项目名称:proxy_project,代码行数:30,代码来源:class.Linux.inc.php

示例3: _filesystems

 /**
  * filesystem information
  *
  * @return void
  */
 private function _filesystems()
 {
     $arrResult = Parser::df("-P");
     foreach ($arrResult as $dev) {
         $this->sys->setDiskDevices($dev);
     }
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:12,代码来源:class.Linux.inc.php

示例4: _filesystems

 /**
  * filesystem information
  *
  * @return void
  */
 private function _filesystems()
 {
     $notwas = true;
     if (CommonFunctions::executeProgram('df', '2>/dev/null ', $df, PSI_DEBUG) && preg_match("/\\s+[0-9\\.]+[KMGT]\\s+/", $df)) {
         $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);
                     $notwas = false;
                 }
             }
         }
     }
     if ($notwas) {
         // try Linux df style
         $arrResult = Parser::df("-P 2>/dev/null", false);
         foreach ($arrResult as $dev) {
             $this->sys->setDiskDevices($dev);
         }
     }
 }
开发者ID:phpsysinfo,项目名称:phpsysinfo,代码行数:89,代码来源:class.Android.inc.php


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