Skip to content

Commit

Permalink
add is_file check
Browse files Browse the repository at this point in the history
  • Loading branch information
reithor committed Dec 11, 2024
1 parent e9b8362 commit fa6a52f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/ReindexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,15 @@ private function getPhpPath()
private function getNumberOfCPUCores()
{
$cores = 1;
if (isset($_SERVER['PLATFORM_BRANCH']) && is_readable('/run/config.json')) {
if (isset($_SERVER['PLATFORM_BRANCH']) && is_readable('/run/config.json') && is_file('/run/config.json')) {
// Ibexa Cloud: read #cpus from config
$configJsonEncoded = file_get_contents('/run/config.json');
if ($configJsonEncoded === false) {
return 1;
}
$configJson = json_decode($configJsonEncoded);
$cores = isset($configJson->info->limits->cpu) ? max(1, (int) ($configJson->info->limits->cpu)) : 1;
} elseif (is_readable('/proc/cpuinfo')) {
} elseif (is_readable('/proc/cpuinfo') && is_file('/proc/cpuinfo')) {
// Linux (and potentially Windows with linux sub systems)
$cpuinfo = file_get_contents('/proc/cpuinfo');
preg_match_all('/^processor/m', $cpuinfo, $matches);
Expand Down

0 comments on commit fa6a52f

Please sign in to comment.