Merged
This commit is contained in:
parent
60e9ad293b
commit
3aeb5a23db
|
@ -1183,3 +1183,22 @@ function names_hash_changed(string $crc_file, array $names) : bool
|
|||
ensure_write($crc_file, $names_crc);
|
||||
return $changed;
|
||||
}
|
||||
|
||||
function is_apple_silicon()
|
||||
{
|
||||
$arch = php_uname('m');
|
||||
|
||||
// Check if the machine type contains 'arm' (ARM architecture)
|
||||
if (strpos($arch, 'arm') !== false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If running on x86_64, check for Apple Silicon using sysctl
|
||||
// (because we might get 'x86_64' when running under Rosetta)
|
||||
if ($arch === 'x86_64') {
|
||||
$sysctl = shell_exec('sysctl -n machdep.cpu.brand_string');
|
||||
return strpos($sysctl, 'Apple') !== false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue