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


PHP COM::execQuery方法代码示例

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


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

示例1: pserverInfo

 static function pserverInfo()
 {
     try {
         $obj = new COM("Winmgmts://./root/cimv2");
     } catch (exception $e) {
         throw new lxException("com_failed", '');
     }
     //$list = $obj->execQuery("select TotalVisibleMemorySize, FreePhysicalMemory, FreeVirtualMemory, TotalVisibleMemorySize from Win32_OperatingSystem");
     $list = $obj->execQuery("select TotalVisibleMemorySize, FreePhysicalMemory, TotalVirtualMemorySize, FreeVirtualMemory from Win32_OperatingSystem");
     foreach ($list as $l) {
         $unit = 1024;
         $ret['priv_s_memory'] = $l->TotalVisibleMemorySize / $unit;
         $ret['used_s_memory'] = ($l->TotalVisibleMemorySize - $l->FreePhysicalMemory) / $unit;
         $ret['priv_s_virtual'] = $l->TotalVirtualMemorySize / $unit;
         $ret['used_s_virtual'] = ($l->TotalVirtualMemorySize - $l->FreeVirtualMemory) / $unit;
         foreach ($ret as &$vvv) {
             $vvv = round($vvv);
         }
     }
     $list = $obj->execQuery("select CurrentClockSpeed, L2CacheSize, Name from Win32_Processor");
     $processornum = 0;
     foreach ($list as $v) {
         $cpu[$processornum]['used_s_cpumodel'] = $v->Name;
         $cpu[$processornum]['used_s_cpuspeed'] = round($v->CurrentClockSpeed / 1000, 3) . " GHz";
         $cpu[$processornum]['used_s_cpucache'] = $v->L2CacheSize;
         $processornum++;
     }
     $ret['cpu'] = $cpu;
     return $ret;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:30,代码来源:pserver__windowslib.php

示例2: getServiceDetails

 static function getServiceDetails($list)
 {
     $obj = new COM("winmgmts:{impersonationLevel=impersonate}//./root/cimv2");
     $servlist = $obj->execQuery("select * from Win32_Service");
     foreach ($list as &$__l) {
         $__l['install_state'] = 'dull';
         $__l['state'] = 'off';
         $__l['boot_state'] = 'off';
     }
     foreach ($servlist as $s) {
         $name = $s->Properties_("Name");
         $name = strtolower($name);
         $name = trim($name);
         if (isset($list[$name])) {
             //dprint($s->Properties_("Name"));
             $__l =& $list[$name];
             $__l['install_state'] = 'on';
             if (trim($s->Properties_("StartMode")) === 'Auto') {
                 $__l['boot_state'] = 'on';
             }
             if (trim($s->Properties_("State")) === 'Running') {
                 $__l['state'] = 'on';
             }
         }
     }
     return $list;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:27,代码来源:service__windowslib.php

示例3: readProcessList

 static function readProcessList()
 {
     try {
         $obj = new COM("Winmgmts:{impersonationLevel=impersonate}!//./root/cimv2");
     } catch (exception $e) {
         throw new lxException("com_failed", 'disk');
     }
     try {
         $list = $obj->execQuery("select * from Win32_Process");
     } catch (exception $e) {
     }
     $i = 0;
     $v = new Variant(42);
     foreach ($list as $l) {
         try {
             $result[$i]['nname'] = $l->ProcessId;
             $result[$i]['command'] = $l->Caption;
             $ret = $l->getOwner($v);
             if ($ret) {
             } else {
                 $result[$i]['username'] = "{$v}";
             }
             $result[$i]['state'] = "ZZ";
             $i++;
         } catch (exception $e) {
             $result[$i]['state'] = "ZZ";
             $result[$i]['nname'] = "Error";
             $result[$i]['command'] = $e->getMessage();
             $result[$i]['username'] = $e->getCode();
         }
     }
     return $result;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:33,代码来源:process__windowslib.php

示例4: getListVersion

 static function getListVersion($syncserver, $list)
 {
     $list[]['componentname'] = 'mysql';
     $list[]['componentname'] = 'perl';
     $list[]['componentname'] = 'php';
     $list[]['componentname'] = 'IIS';
     $list[]['componentname'] = 'Photoshop';
     $list[]['componentname'] = 'InternetExplorer';
     try {
         $obj = new COM("Winmgmts://./root/cimv2");
     } catch (exception $e) {
         throw new lxException("com_failed", 'disk');
     }
     $nlist = $obj->execQuery("select * from Win32_Product");
     foreach ($nlist as $k => $l) {
         $name = $l->Name;
         $sing['nname'] = $name . "___" . $syncserver;
         $sing['componentname'] = $name;
         $sing['status'] = "off";
         $sing['version'] = "Not Installed";
         $sing['version'] = $l->Version;
         $sing['status'] = "on";
         /*
         	if (isOn($sing['status'])) {
         		$sing['full_version'] = `rpm -qi $name`; 
         	} else {
         		$sing['full_version'] = $sing['version'];
         	}
         */
         $ret[] = $sing;
     }
     return $ret;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:33,代码来源:component__windowslib.php

示例5: getDiskUsage

 static function getDiskUsage()
 {
     try {
         $obj = new COM("Winmgmts://./root/cimv2");
     } catch (exception $e) {
         throw new lxException("com_failed", 'disk');
     }
     $i = 0;
     $list = $obj->execQuery("select * from Win32_LogicalDisk");
     foreach ($list as $l) {
         $result[$i]['nname'] = $l->Name;
         $result[$i]['kblock'] = round($l->Size / 1000);
         $result[$i]['available'] = round($l->FreeSpace / 1000);
         $result[$i]['used'] = $result[$i]['kblock'] - $result[$i]['available'];
         $result[$i]['pused'] = $result[$i]['used'] / $result[$i]['kblock'];
         $result[$i]['mountedon'] = $l->Name;
         $i++;
     }
     return $result;
 }
开发者ID:lonelywoolf,项目名称:hypervm,代码行数:20,代码来源:diskusage__windowslib.php

示例6: findOperatingSystem

function findOperatingSystem($type = null)
{
    if (windowsOs()) {
        $ret['os'] = 'windows';
        try {
            $obj = new COM("Winmgmts://./root/cimv2");
        } catch (exception $e) {
            //throw new lxException("com_failed", '');
            return null;
        }
        $list = $obj->execQuery("select Caption from Win32_OperatingSystem");
        foreach ($list as $l) {
            $ret['version'] = $l->Caption;
            $ret['pointversion'] = $l->Caption;
        }
        return $ret;
    }
    if (file_exists("/etc/fedora-release")) {
        $ret['os'] = 'fedora';
        $ret['version'] = file_get_contents("/etc/fedora-release");
        $ret['pointversion'] = find_os_pointversion();
    } else {
        if (file_exists("/etc/redhat-release")) {
            $ret['os'] = 'rhel';
            $ret['version'] = file_get_contents("/etc/redhat-release");
            $ret['pointversion'] = find_os_pointversion();
        }
    }
    /* -- not work because no driver for centos inside /usr/local/lxlabs/kloxo/file/conf
    
    	$ret['os'] = find_os_distro();
    	$ret['version'] = find_os_release();
    	$ret['pointversion'] = find_os_pointversion();
    */
    if (lxfile_exists("__path_program_etc/install_xen") || lxfile_exists("/proc/xen")) {
        $ret['vpstype'] = "xen";
        $ret['xenlocation'] = vg_complete();
    }
    if ($type) {
        return $ret[$type];
    }
    return $ret;
}
开发者ID:zseand,项目名称:kloxo,代码行数:43,代码来源:lxlib.php


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