Define HAVE_OMP_PAUSE_RESOURCE_ALL to 0, add additional file system func

This commit is contained in:
crazywhalecc
2025-03-30 14:01:31 +08:00
parent 88ce2eafab
commit 936413a6d9
2 changed files with 24 additions and 3 deletions

View File

@@ -461,6 +461,23 @@ class FileSystem
}
}
/**
* @throws FileSystemException
*/
public static function replaceFileLineContainsString(string $file, string $find, string $line): false|int
{
$lines = file($file);
if ($lines === false) {
throw new FileSystemException('Cannot read file: ' . $file);
}
foreach ($lines as $key => $value) {
if (str_contains($value, $find)) {
$lines[$key] = $line . PHP_EOL;
}
}
return file_put_contents($file, implode('', $lines));
}
/**
* @throws RuntimeException
* @throws FileSystemException