How to use is_windows method of phodevi class

Best Phoronix-test-suite code snippet using phodevi.is_windows

phodevi_motherboard.php

Source:phodevi_motherboard.php Github

copy

Full Screen

...46 {47 $status = 'Disabled';48 }49 }50 else if(phodevi::is_windows())51 {52 $confirm = shell_exec('powershell -NoProfile "Confirm-SecureBootUEFI"');53 if(strpos($confirm, 'True') !== false)54 {55 $status = 'Enabled';56 }57 else if(strpos($confirm, 'False') !== false)58 {59 $status = 'Disabled';60 }61 }62 return $status;63 }64 public static function boot_mode()65 {66 $boot_mode = 'Unknown';67 if(phodevi::is_linux())68 {69 if(!is_dir('/sys/firmware/efi'))70 {71 $boot_mode = 'Legacy BIOS';72 }73 else74 {75 $boot_mode = 'EFI';76 }77 }78 else if(phodevi::is_windows())79 {80 $bcdedit = shell_exec('bcdedit');81 if(strpos($bcdedit, '.efi') !== false)82 {83 $boot_mode = 'EFI';84 }85 else if(strpos($bcdedit, 'path') !== false)86 {87 $boot_mode = 'Legacy BIOS';88 }89 }90 return $boot_mode;91 }92 public static function tpm_devices()93 {94 $tpm = array();95 if(phodevi::is_linux())96 {97 foreach(pts_file_io::glob('/sys/class/tpm/tpm*/device/description') as $tpm_desc)98 {99 $model = pts_file_io::file_get_contents($tpm_desc);100 $dir = dirname($tpm_desc);101 if(is_file($dir . '/hid'))102 {103 $model .= ' ' . pts_file_io::file_get_contents($dir . '/hid');104 }105 $tpm[] = $model;106 }107 }108 return implode(' + ', $tpm);109 }110 public static function usb_devices()111 {112 $usb = array();113 if(phodevi::is_linux())114 {115 foreach(pts_file_io::glob('/sys/bus/usb/devices/*-*/manufacturer') as $usb_dir)116 {117 $usb_dir = dirname($usb_dir) . '/';118 if(!is_file($usb_dir . 'product') || !is_file($usb_dir . 'idProduct') || !is_file($usb_dir . 'idVendor'))119 {120 continue;121 }122 $vendor = pts_strings::trim_search_query(pts_strings::strip_string(pts_file_io::file_get_contents($usb_dir . 'manufacturer')));123 $device = pts_strings::trim_search_query(pts_strings::strip_string(str_replace($vendor, '', pts_file_io::file_get_contents($usb_dir . 'product'))));124 $device = pts_strings::keep_in_string($device, pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_SPACE | pts_strings::CHAR_DASH | pts_strings::CHAR_UNDERSCORE | pts_strings::CHAR_COLON | pts_strings::CHAR_COMMA);125 if($vendor == null || $device == null || $vendor == 'Generic')126 {127 continue;128 }129 array_push($usb, array(130 'Class' => pts_file_io::file_get_contents($usb_dir . 'bDeviceClass'),131 'Vendor' => $vendor,132 'Device' => $device,133 'VendorID' => pts_file_io::file_get_contents($usb_dir . 'idVendor'),134 'DeviceID' => pts_file_io::file_get_contents($usb_dir . 'idProduct')135 ));136 }137 }138 return $usb;139 }140 public static function is_genuine($mobo)141 {142 return strpos($mobo, ' ') > 1 && !pts_strings::has_in_istring($mobo, array('Virtual', 'Bochs', '440BX', 'Megatrends', 'Award ', 'Software', 'Xen', 'HVM ', 'Notebook', 'OEM ', ' KVM', 'unknown')) && !is_numeric(substr($mobo, 0, strpos($mobo, ' ')));143 // pts_strings::string_contains($mobo, pts_strings::CHAR_NUMERIC);144 }145 public static function pci_devices()146 {147 $pci_devices = array();148 if(phodevi::is_linux() && isset(phodevi::$vfs->lspci))149 {150 $lspci = phodevi::$vfs->lspci;151 $lspci = explode("\n\n", $lspci);152 foreach($lspci as $o => &$lspci_section)153 {154 $lspci_section = explode("\n", $lspci_section);155 $formatted_section = array();156 foreach($lspci_section as $i => &$line)157 {158 $line = explode(':', $line);159 if(count($line) == 2 && in_array($line[0], array('Class', 'Vendor', 'Device', 'Driver', 'Rev', 'Module')))160 {161 $line[1] = trim($line[1]);162 if(($c = strrpos($line[1], ' [')) !== false)163 {164 $id = substr($line[1], ($c + 2));165 $id = '0x' . substr($id, 0, strpos($id, ']'));166 switch($line[0])167 {168 case 'Vendor':169 $formatted_section['VendorID'] = $id;170 break;171 case 'Device':172 $formatted_section['DeviceID'] = $id;173 break;174 }175 $line[1] = substr($line[1], 0, $c);176 }177 if($line[0] == 'Class')178 {179 switch($line[1])180 {181 case 'Ethernet controller':182 case 'Network controller':183 $line[1] = 'Network';184 break;185 case 'VGA compatible controller':186 $line[1] = 'GPU';187 break;188 case 'Audio device':189 case 'Multimedia audio controller':190 $line[1] = 'Audio';191 break;192 // case 'RAM memory':193 // case 'Host bridge':194 // $line[1] = 'Chipset';195 // break;196 default:197 $line[1] = null;198 break;199 }200 }201 else if($line[0] == 'Device' || $line[0] == 'Vendor')202 {203 $line[1] = pts_strings::trim_search_query(pts_strings::strip_string($line[1]));204 $line[1] = pts_strings::keep_in_string($line[1], pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_SPACE | pts_strings::CHAR_DASH | pts_strings::CHAR_UNDERSCORE | pts_strings::CHAR_COLON | pts_strings::CHAR_COMMA);205 }206 $formatted_section[$line[0]] = $line[1];207 }208 }209 if(count($formatted_section) > 0 && $formatted_section['Class'] != null)210 {211 array_push($pci_devices, $formatted_section);212 }213 }214 }215 return $pci_devices;216 }217 public static function parse_pci_device_data(&$lspci, &$dmesg, $ignore_external_pci_devices = false)218 {219 $pci_devices = explode(PHP_EOL . PHP_EOL, $lspci);220 $sanitized_devices = array();221 foreach($pci_devices as &$device)222 {223 $device .= PHP_EOL;224 $location = substr($device, 0, strpos($device, ' '));225 if(!strpos($location, ':') || !strpos($location, '.'))226 {227 // If it's not a valid PCI bus location (i.e. XX:YY.Z), it's probably not formatted well or wrong228 continue;229 }230 $class = substr($device, ($s = (strpos($device, '[') + 1)), (strpos($device, ']', $s) - $s));231 if(!(isset($class[3]) && !isset($class[4])))232 {233 // class must be 4 characters: 2 for class, 2 for sub-class234 continue;235 }236 // 0300 is GPUs237 if($ignore_external_pci_devices && in_array($class, array('0300')))238 {239 // Don't report external PCI devices240 continue;241 }242 $device_class = substr($class, 0, 2);243 $sub_class = substr($class, 2, 2);244 $device_name = substr($device, ($l = strpos($device, ']:') + 3), ($s = strpos($device, ':', $l)) - $l);245 $device_name = substr($device_name, 0, strrpos($device_name, ' ['));246 $device_name = str_replace('/', '-', str_replace(array('[AMD]', '[SiS]'), '', $device_name));247 $device_name = pts_strings::strip_string($device_name);248 if($device_name == null || strpos($device_name, ' ') === false)249 {250 // it must be junk not worth reporting251 continue;252 }253 $temp = substr($device, $s - 5);254 if($temp[0] != '[' || $temp[10] != ']')255 {256 continue;257 }258 $vendor_id = substr($temp, 1, 4);259 $device_id = substr($temp, 6, 4);260 $drivers = array();261 if(($s = strpos($device, 'Kernel driver in use:')) !== false)262 {263 $temp = substr($device, ($s = $s + 22), (strpos($device, PHP_EOL, $s) - $s));264 if($temp != null)265 {266 array_push($drivers, $temp);267 }268 }269 if(($s = strpos($device, 'Kernel modules:')) !== false)270 {271 $temp = substr($device, ($s = $s + 16), (strpos($device, PHP_EOL, $s) - $s));272 if($temp != null)273 {274 foreach(explode(' ', trim($temp)) as $temp)275 {276 $temp = str_replace(',', '', $temp);277 if($temp != null && !in_array($temp, $drivers))278 {279 array_push($drivers, $temp);280 }281 }282 }283 }284 if(empty($drivers))285 {286 // If there's no drivers, nothing to report287 continue;288 }289 if(!in_array($vendor_id . ':' . $device_id, array_keys($sanitized_devices)))290 {291 $dmesg_example = array();292 if($dmesg != null)293 {294 foreach($drivers as $driver)295 {296 $offset = 1;297 while($offset != false && ($offset = strpos($dmesg, $driver, $offset)) !== false)298 {299 $line = substr($dmesg, 0, strpos($dmesg, "\n", $offset));300 $line = substr($line, strrpos($line, "\n"));301 $line = trim(substr($line, strpos($line, '] ') + 2));302 if($line != null && !isset($line[128]))303 {304 array_push($dmesg_example, $line);305 }306 $offset = strpos($dmesg, "\n", ($offset + 1));307 }308 }309 }310 $sanitized_devices[$vendor_id . ':' . $device_id] = array(311 $vendor_id,312 $device_id,313 $device_name,314 $device_class,315 $sub_class,316 $drivers,317 trim($device),318 implode(PHP_EOL, $dmesg_example)319 );320 }321 }322 return $sanitized_devices;323 }324 public static function power_mode()325 {326 // Returns the power mode327 $return_status = null;328 if(phodevi::is_linux())329 {330 $sysfs_checked = false;331 foreach(pts_file_io::glob('/sys/class/power_supply/AC*/online') as $online)332 {333 if(pts_file_io::file_get_contents($online) == '0')334 {335 $return_status = 'This computer was running on battery power';336 break;337 }338 $sysfs_checked = true;339 }340 if(!$sysfs_checked)341 {342 // There likely was no sysfs power_supply support for that power adapter343 $power_state = phodevi_linux_parser::read_acpi('/ac_adapter/AC/state', 'state');344 if($power_state == 'off-line')345 {346 $return_status = 'This computer was running on battery power';347 }348 }349 }350 return $return_status;351 }352 public static function serial_number()353 {354 $serial = null;355 if(phodevi::is_linux())356 {357 $serial = phodevi_linux_parser::read_dmidecode('system', 'System Information', 'Serial Number', true, array());358 if($serial == null)359 {360 $serial = phodevi_linux_parser::read_sys_dmi('board_serial');361 }362 if($serial == null)363 {364 $serial = phodevi_linux_parser::read_sys_dmi('product_serial');365 }366 if($serial == null)367 {368 $serial = phodevi_linux_parser::read_sys_dmi('product_uuid');369 }370 }371 else if(phodevi::is_windows())372 {373 $serial = phodevi_windows_parser::get_wmi_object('Win32_BaseBoard', 'SerialNumber');374 }375 return $serial;376 }377 public static function bios_version()378 {379 $bios_version = null;380 if(phodevi::is_bsd())381 {382 $bios_version = phodevi_bsd_parser::read_kenv('smbios.system.version');383 if($bios_version == 'System Version')384 {385 $bios_version = null;386 }387 }388 else if(phodevi::is_linux())389 {390 $bios_version = phodevi_linux_parser::read_sys_dmi('bios_version');391 }392 else if(phodevi::is_windows())393 {394 $bios_version = trim(str_ireplace(array('smbiosbiosversion', "\n"), '', shell_exec('wmic bios get smbiosbiosversion')));395 }396 if($bios_version == 'Google')397 {398 $bios_version = null;399 }400 return empty($bios_version) ? '' : trim(str_replace(array('(', ')'), '', $bios_version));401 }402 public static function motherboard_string()403 {404 // Returns the motherboard / system model name or number405 $info = null;406 if(phodevi::is_macos())407 {408 $info = phodevi_osx_parser::read_osx_system_profiler('SPHardwareDataType', 'ModelName');409 }410 else if(phodevi::is_solaris())411 {412 $manufacturer = phodevi_solaris_parser::read_sun_ddu_dmi_info(array('MotherBoardInformation,Manufacturer', 'SystemInformation,Manufacturer'));413 $product = phodevi_solaris_parser::read_sun_ddu_dmi_info(array('MotherBoardInformation,Product', 'SystemInformation,Product', 'SystemInformation,Model'));414 if(count($manufacturer) == 1 && count($product) == 1)415 {416 $info = $manufacturer[0] . ' ' . $product[0];417 }418 }419 else if(phodevi::is_bsd())420 {421 $vendor = phodevi_bsd_parser::read_kenv('smbios.system.maker');422 $product = phodevi_bsd_parser::read_kenv('smbios.system.product');423 $version = phodevi_bsd_parser::read_kenv('smbios.system.version'); // for at least Lenovo ThinkPads this is where it displays ThinkPad model424 if($vendor != null && ($product != null || $version != null) && strpos($product, 'System') === false)425 {426 $info = $vendor . ' ' . $product . ' ' . $version;427 }428 else if(($vendor = phodevi_bsd_parser::read_sysctl('hw.vendor')) != false && ($version = phodevi_bsd_parser::read_sysctl(array('hw.version', 'hw.product'))) != false)429 {430 $info = trim($vendor . ' ' . $version);431 }432 else if(($product = phodevi_bsd_parser::read_kenv('smbios.planar.product')))433 {434 $info = trim(phodevi_bsd_parser::read_kenv('smbios.planar.maker') . ' ' . $product);435 }436 else if(($acpi = phodevi_bsd_parser::read_sysctl('dev.acpi.0.%desc')) != false && strpos($acpi, ' ') != null)437 {438 $info = trim($acpi);439 }440 }441 else if(phodevi::is_linux())442 {443 $vendor = phodevi_linux_parser::read_sys_dmi(array('board_vendor', 'sys_vendor'));444 $name = phodevi_linux_parser::read_sys_dmi(array('board_name', 'product_name'));445 $version = phodevi_linux_parser::read_sys_dmi(array('board_version', 'product_version'));446 if($vendor != false && $name != false)447 {448 $info = strpos($name . ' ', $vendor . ' ') === false ? $vendor . ' ' : null;449 $info .= $name;450 if($version != false && strpos($info, $version) === false && pts_strings::string_only_contains($version, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL))451 {452 $info .= (substr($version, 0, 1) == 'v' ? ' ' : ' v') . $version;453 }454 if((phodevi::is_root() || is_readable('/dev/mem')) && pts_client::executable_in_path('dmidecode'))455 {456 // For some vendors, it's better to read system-product-name457 // Unfortunately other vendors report garbage here, also demidecode only works as root on Linux458 foreach(array('Dell', 'Apple') as $vend)459 {460 if(stripos($info, $vend . ' ') !== false)461 {462 $dmi_output = shell_exec('dmidecode -s system-product-name 2>&1');463 if($dmi_output != null && stripos($dmi_output, ' ') !== false && stripos($dmi_output, 'invalid') === false && stripos($dmi_output, 'System Product') === false && stripos($dmi_output, 'not ') === false)464 {465 $old_info = trim(str_ireplace(array($vend . ' ', 'Inc.'), '', $info));466 $info = trim($dmi_output) . (!empty($old_info) && strpos($dmi_output, $old_info) === false ? ' [' . $old_info . ']' : '');467 }468 if($info != null && stripos($info, $vend) === false)469 {470 $info = $vend . ' ' . $info;471 break;472 }473 }474 }475 }476 }477 if(empty($info))478 {479 $from_cpuinfo = false;480 if($info == null)481 {482 $hw_string = phodevi_linux_parser::read_cpuinfo('Hardware');483 if(count($hw_string) == 1)484 {485 $info = $hw_string[0];486 $from_cpuinfo = true;487 }488 }489 $bios_vendor = phodevi_linux_parser::read_sys_dmi('bios_vendor');490 $bios_version = phodevi_linux_parser::read_sys_dmi('bios_version');491 if($bios_vendor != null)492 {493 $info = $bios_vendor . ' ' . $bios_version;494 }495 if($info == null)496 {497 $hw_string = phodevi_linux_parser::read_cpuinfo('machine');498 if(count($hw_string) == 1)499 {500 $info = $hw_string[0];501 $from_cpuinfo = true;502 }503 }504 if($from_cpuinfo && is_readable('/sys/firmware/devicetree/base/model'))505 {506 $dt_model = pts_file_io::file_get_contents('/sys/firmware/devicetree/base/model');507 if($info == null || stripos($dt_model, $info) === false)508 {509 $info = trim($info . ' ' . $dt_model);510 }511 }512 }513 if(empty($info))514 {515 $info = phodevi_linux_parser::read_sys_dmi('product_name');516 }517 if(empty($info) && is_file('/sys/bus/soc/devices/soc0/machine'))518 {519 $info = pts_file_io::file_get_contents('/sys/bus/soc/devices/soc0/machine');520 }521 if(empty($info) && is_readable('/sys/firmware/devicetree/base/model'))522 {523 $info = pts_file_io::file_get_contents('/sys/firmware/devicetree/base/model');524 }525 if(empty($info))526 {527 // Works on the MIPS Creator CI20528 $hardware = phodevi_linux_parser::read_cpuinfo('Hardware');529 if(!empty($hardware))530 {531 $info = array_pop($hardware);532 }533 }534 }535 else if(phodevi::is_windows())536 {537 $info = trim(phodevi_windows_parser::get_wmi_object('Win32_BaseBoard', 'Manufacturer') . ' ' . phodevi_windows_parser::get_wmi_object('Win32_BaseBoard', 'Product'));538 if(empty($info))539 {540 $info = phodevi_windows_parser::get_wmi_object('Win32_MotherboardDevice', 'Name');541 }542 foreach(array('Dell', 'Apple') as $vend)543 {544 if(stripos($info, $vend . ' ') !== false)545 {546 $wmi = shell_exec('wmic csproduct get name');547 if(($x = strpos($wmi, 'Name')) !== false)548 {549 $wmi = trim(substr($wmi, $x + 4));...

Full Screen

Full Screen

phodevi_memory.php

Source:phodevi_memory.php Github

copy

Full Screen

...56 $mem_speed = array_shift($mem_speed);57 }58 $mem_speed = str_replace('MHZ', 'MHz', $mem_speed);59 }60 else if(phodevi::is_windows())61 {62 $mem_size = phodevi_windows_parser::read_cpuz('DIMM #', 'Size', true);63 foreach($mem_size as $key => &$individual_size)64 {65 $individual_size = pts_arrays::first_element(explode(' ', $individual_size));66 if(!is_numeric($individual_size))67 {68 unset($mem_size[$key]);69 } 70 }71 $mem_type = phodevi_windows_parser::read_cpuz('Memory Type', null);72 $mem_speed = intval(phodevi_windows_parser::read_cpuz('Memory Frequency', null)) . 'MHz';73 }74 else if(phodevi::is_linux())75 {76 $mem_size = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Size', false, array('Not Installed', 'No Module Installed', 'Undefined'));77 $mem_speed = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Configured Clock Speed', true, array('Unknown', 'Undefined'));78 if($mem_speed == false)79 {80 // "Speed" only reports stock frequency where "Configured Clock Speed" should report the over/underclocked memory81 $mem_speed = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Speed', true, array('Unknown', 'Undefined'));82 }83 $mem_type = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Type', true, array('Unknown', 'Other', 'Flash', 'Undefined'));84 $mem_manufacturer = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Manufacturer', true, array('Unknown', 'Undefined'));85 $mem_part = phodevi_linux_parser::read_dmidecode('memory', 'Memory Device', 'Part Number', true, array('Unknown', 'Undefined'));86 }87 if(is_array($mem_type))88 {89 $mem_type = array_pop($mem_type);90 }91 if($mem_size != false && (!is_array($mem_size) || count($mem_size) != 0))92 {93 for($i = 0; $i < count($mem_size); $i++)94 {95 switch(substr($mem_size[$i], -1))96 {97 case 'K':98 // looks like sometimes Solaris now reports flash chip as memory. its string ends with K99 unset($mem_size[$i]);100 unset($mem_speed[$i]);101 unset($mem_type[$i]);102 break;103 case 'M':104 // report megabytes as MB, just not M, as on Solaris105 $mem_size[$i] .= 'B';106 break;107 case 'B':108 if(strtolower(substr($mem_size[$i], -2, 1)) == 'k')109 {110 // some hardware on Linux via dmidecode reports flash chips111 unset($mem_size[$i]);112 //unset($mem_speed[$i]);113 //unset($mem_type[$i]);114 }115 break;116 }117 }118 foreach($mem_size as $i => $mem_stick)119 {120 if(!is_numeric(substr($mem_stick, 0, 3)) && stripos($mem_stick, 'GB') == false)121 {122 // If the memory size isn't at least three digits (basically 128MB+), chances are something is wrong, i.e. reporting flash chip from dmidecode, so get rid of it.123 unset($mem_size[$i]);124 }125 }126 $mem_count = count($mem_size);127 if(!empty($mem_type))128 {129 if(($cut = strpos($mem_type, ' ')) > 0)130 {131 $mem_type = substr($mem_type, 0, $cut);132 }133 if(!in_array($mem_type, array('Other')) && (pts_strings::keep_in_string($mem_type, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_LETTER) == $mem_type || phodevi::is_windows()))134 {135 $mem_prefix = $mem_type;136 }137 }138 else139 {140 $mem_prefix = null;141 }142 if(!empty($mem_speed))143 {144 if(($cut = strpos($mem_speed, ' (')) > 0)145 {146 $mem_speed = substr($mem_speed, 0, $cut);147 }148 if(!empty($mem_prefix))149 {150 $mem_prefix .= '-';151 }152 $mem_prefix .= str_replace(' ', null, $mem_speed);153 }154 // TODO: Allow a combination of both functions below, so like 2 x 2GB + 3 x 1GB DDR2-800155 if($mem_count > 1 && count(array_unique($mem_size)) > 1)156 {157 $mem_string = implode(' + ', $mem_size) . ' ' . $mem_prefix;158 }159 else160 {161 if(($mem_count * $mem_size[0]) != phodevi::read_property('memory', 'capacity') && phodevi::read_property('memory', 'capacity') % $mem_size[0] == 0)162 {163 // This makes sure the correct number of RAM modules is reported...164 // On at least Linux with dmidecode on an AMD Opteron multi-socket setup it's only showing the data for one socket165 if($mem_size[0] < 1024)166 {167 $mem_size[0] *= 1024;168 }169 $mem_count = phodevi::read_property('memory', 'capacity') / $mem_size[0];170 }171 $product_string = null;172 if(isset($mem_manufacturer[2]) && pts_strings::is_alpha($mem_manufacturer[0]) && stripos($mem_manufacturer, 'manufacturer') === false && stripos($mem_manufacturer, 'part') === false && stripos($mem_manufacturer, 'module') === false && stripos($mem_manufacturer, 'dimm') === false && isset($mem_manufacturer[2]) && pts_strings::is_alpha($mem_manufacturer))173 {174 $product_string .= ' ' . $mem_manufacturer;175 }176 if(($x = strpos($mem_part, '/')) !== false)177 {178 // Cleanup/shorten strings like KHX2133C13S4/4G179 $mem_part = substr($mem_part, 0, $x);180 }181 if(isset($mem_part[2]) && stripos($mem_part, 'part') === false && stripos($mem_part, 'module') === false && stripos($mem_part, 'dimm') === false && substr($mem_part, 0, 2) != '0x' && !isset($mem_part[24]) && pts_strings::is_alnum($mem_part))182 {183 $product_string .= ' ' . $mem_part;184 }185 if(is_numeric($mem_size[0]) && stripos($mem_size[0], 'b') === false)186 {187 if($mem_size >= 1024)188 {189 $mem_size[0] .= ' MB';190 }191 else192 {193 $mem_size[0] .= ' GB';194 }195 }196 $mem_string = $mem_count . ' x ' . $mem_size[0] . ' ' . $mem_prefix . $product_string;197 }198 }199 if(empty($mem_string))200 {201 $mem_string = phodevi::read_property('memory', 'capacity');202 if($mem_string != null)203 {204 $mem_string .= 'MB';205 }206 }207 return trim($mem_string);208 }209 public static function memory_capacity()210 {211 // Returns physical memory capacity212 if(isset(phodevi::$vfs->meminfo))213 {214 $info = phodevi::$vfs->meminfo;215 $info = substr($info, strpos($info, 'MemTotal:') + 9);216 $info = intval(trim(substr($info, 0, strpos($info, 'kB'))));217 $info = floor($info / 1024);218 if(is_numeric($info) && $info > 950)219 {220 if($info > 4608)221 {222 $info = ceil($info / 1024) * 1024;223 }224 else if($info > 1536)225 {226 $info = ceil($info / 512) * 512;227 }228 else229 {230 $info = ceil($info / 256) * 256;231 }232 }233 }234 else if(phodevi::is_solaris())235 {236 $info = shell_exec('prtconf 2>&1 | grep Memory');237 $info = substr($info, strpos($info, ':') + 2);238 $info = substr($info, 0, strpos($info, 'Megabytes'));239 }240 else if(phodevi::is_bsd())241 {242 $mem_size = phodevi_bsd_parser::read_sysctl('hw.physmem');243 if($mem_size == false)244 {245 $mem_size = phodevi_bsd_parser::read_sysctl('hw.realmem');246 }247 $info = ceil(floor($mem_size / 1048576) / 256) * 256;248 }249 else if(phodevi::is_macosx())250 {251 $info = phodevi_osx_parser::read_osx_system_profiler('SPHardwareDataType', 'Memory');252 $info = explode(' ', $info);253 $info = (isset($info[1]) && $info[1] == 'GB' ? $info[0] * 1024 : $info[0]);254 }255 else if(phodevi::is_windows())256 {257 $info = phodevi_windows_parser::read_cpuz('Memory Size', null);258 if($info != null)259 {260 if(($e = strpos($info, ' MBytes')) !== false)261 {262 $info = substr($info, 0, $e);263 }264 $info = trim($info);265 }266 }267 else268 {269 $info = null;...

Full Screen

Full Screen

is_windows

Using AI Code Generation

copy

Full Screen

1$phodevi = new phodevi();2$phodevi->is_windows();3$phodevi = new phodevi();4$phodevi->is_windows();5$phodevi = new phodevi();6$phodevi->is_windows();7$phodevi = new phodevi();8$phodevi->is_windows();9$phodevi = new phodevi();10$phodevi->is_windows();11$phodevi = new phodevi();12$phodevi->is_windows();13$phodevi = new phodevi();14$phodevi->is_windows();15$phodevi = new phodevi();16$phodevi->is_windows();17$phodevi = new phodevi();18$phodevi->is_windows();19$phodevi = new phodevi();20$phodevi->is_windows();21$phodevi = new phodevi();22$phodevi->is_windows();23$phodevi = new phodevi();24$phodevi->is_windows();25$phodevi = new phodevi();26$phodevi->is_windows();

Full Screen

Full Screen

is_windows

Using AI Code Generation

copy

Full Screen

1if( phodevi::is_windows() )2{3}4{5}6if( phodevi::is_windows() )7{8}9{10}11if( phodevi::is_windows() )12{13}14{15}16if( phodevi::is_windows() )17{18}19{20}21if( phodevi::is_windows() )22{23}24{25}26if( phodevi::is_windows() )27{28}29{30}31if( phodevi::is_windows() )32{33}34{35}36if( phodevi::is_windows() )37{38}39{40}41if( phodevi::is_windows() )42{43}44{45}46if( phodevi::is_windows() )47{48}49{50}51if( phodevi::is_windows() )52{53}54{55}

Full Screen

Full Screen

is_windows

Using AI Code Generation

copy

Full Screen

1$phodevi = new phodevi();2if($phodevi->is_windows())3{4}5{6}7$phodevi = new phodevi();8if($phodevi->is_linux())9{10}11{12}13$phodevi = new phodevi();14if($phodevi->is_mac())15{16}17{18}19$phodevi = new phodevi();20if($phodevi->is_android())21{22}23{24}25$phodevi = new phodevi();26if($phodevi->is_ios())27{28}29{30}31$phodevi = new phodevi();32if($phodevi->is_browser())33{34}35{36}37$phodevi = new phodevi();38if($phodevi->is_bot())39{40}41{42}43$phodevi = new phodevi();44if($phodevi->is_tablet())45{46}47{48}49$phodevi = new phodevi();50if($phodevi->

Full Screen

Full Screen

is_windows

Using AI Code Generation

copy

Full Screen

1include 'phodevi.php';2echo phodevi::is_windows();3include 'phodevi.php';4echo phodevi::is_linux();5include 'phodevi.php';6echo phodevi::get_cpu_architecture();7include 'phodevi.php';8echo phodevi::get_cpu_cores();9include 'phodevi.php';10echo phodevi::get_cpu_frequency();11include 'phodevi.php';12echo phodevi::get_cpu_model();13include 'phodevi.php';14echo phodevi::get_cpu_vendor();15include 'phodevi.php';16echo phodevi::get_cpu_logical_cores();17include 'phodevi.php';18echo phodevi::get_cpu_thread_count();19include 'phodevi.php';20echo phodevi::get_cpu_vendor();

Full Screen

Full Screen

is_windows

Using AI Code Generation

copy

Full Screen

1require_once 'phodevi.php';2if (phodevi::is_windows()) {3 echo "This is windows";4} else {5 echo "This is not windows";6}7require_once 'phodevi.php';8if (phodevi::is_linux()) {9 echo "This is linux";10} else {11 echo "This is not linux";12}13require_once 'phodevi.php';14if (phodevi::is_mac()) {15 echo "This is mac";16} else {17 echo "This is not mac";18}19require_once 'phodevi.php';20if (phodevi::is_bsd()) {21 echo "This is bsd";22} else {23 echo "This is not bsd";24}25require_once 'phodevi.php';26if (phodevi::is_solaris()) {27 echo "This is solaris";28} else {29 echo "This is not solaris";30}31require_once 'phodevi.php';32if (phodevi::is_osx()) {33 echo "This is osx";34} else {35 echo "This is not osx";36}37require_once 'phodevi.php';38if (phodevi::is_android()) {39 echo "This is android";40} else {41 echo "This is not android";42}43require_once 'phodevi.php';44if (phodevi::is_ios()) {45 echo "This is ios";46} else {47 echo "This is not ios";48}

Full Screen

Full Screen

is_windows

Using AI Code Generation

copy

Full Screen

1if(phodevi::is_windows())2{3 echo "windows";4}5{6 echo "linux";7}8require_once('phodevi.php');9if(phodevi::is_windows())10{11 echo "windows";12}13{14 echo "linux";15}16require_once('phodevi.php');17if(phodevi::is_windows())18{19 echo "windows";20}21{22 echo "linux";23}24require_once('phodevi.php');25if(phodevi::is_windows())26{27 echo "windows";28}29{30 echo "linux";31}32require_once('phodevi.php');33if(phodevi::is_windows())34{35 echo "windows";36}37{38 echo "linux";39}40require_once('phodevi.php');41if(phodevi::is_windows())42{43 echo "windows";44}45{46 echo "linux";47}48require_once('phodevi.php');49if(phodevi::is_windows())50{51 echo "windows";52}53{54 echo "linux";55}56require_once('phodevi.php');57if(phodevi::is_windows())58{59 echo "windows";60}61{62 echo "linux";63}64require_once('phodevi.php');65if(phodevi::is_windows())66{67 echo "windows";68}69{70 echo "linux";71}72require_once('phodevi.php');73if(phodevi::is_windows())74{75 echo "windows";76}77{78 echo "linux";79}

Full Screen

Full Screen

is_windows

Using AI Code Generation

copy

Full Screen

1if(phodevi::is_windows())2{3 echo "Windows";4}5{6 echo "Not Windows";7}8if(phodevi::is_windows())9{10 echo "Windows";11}12{13 echo "Not Windows";14}15Recommended Posts: PHP | phodevi::is_linux() Method16PHP | phodevi::is_mac() Method17PHP | phodevi::is_hypervisor() Method18PHP | phodevi::is_virtual_machine() Method19PHP | phodevi::is_virtualized() Method20PHP | phodevi::is_x86() Method21PHP | phodevi::is_x64() Method22PHP | phodevi::is_arm() Method23PHP | phodevi::is_arm64() Method24PHP | phodevi::is_ppc() Method25PHP | phodevi::is_ppc64() Method26PHP | phodevi::is_ppc64le() Method27PHP | phodevi::is_sparc() Method28PHP | phodevi::is_sparc64() Method29PHP | phodevi::is_i386() Method30PHP | phodevi::is_i486() Method31PHP | phodevi::is_i586() Method32PHP | phodevi::is_i686() Method33PHP | phodevi::is_i786() Method34PHP | phodevi::is_i886() Method35PHP | phodevi::is_i986() Method36PHP | phodevi::is_i1086() Method37PHP | phodevi::is_i1286() Method38PHP | phodevi::is_i1486() Method39PHP | phodevi::is_i1686() Method40PHP | phodevi::is_i1886() Method41PHP | phodevi::is_i2086() Method42PHP | phodevi::is_i2286() Method

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful