Replace disallowed operators in tools/

This commit is contained in:
Dylan K. Taylor 2022-01-20 16:48:06 +00:00
parent 9c328690f8
commit 4d55935bd8
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 4 additions and 4 deletions

View File

@ -62,12 +62,12 @@ function find_regions_recursive(string $dir, array &$files) : void{
return;
}
foreach($dirFiles as $file){
if($file === "." or $file === ".."){
if($file === "." || $file === ".."){
continue;
}
$fullPath = $dir . "/" . $file;
if(
in_array(pathinfo($fullPath, PATHINFO_EXTENSION), SUPPORTED_EXTENSIONS, true) and
in_array(pathinfo($fullPath, PATHINFO_EXTENSION), SUPPORTED_EXTENSIONS, true) &&
is_file($fullPath)
){
$files[$fullPath] = filesize($fullPath);

View File

@ -59,7 +59,7 @@ if($inputPath === false){
exit(1);
}
$backupPath = realpath($args["backup"]);
if($backupPath === false || (!@mkdir($backupPath, 0777, true) and !is_dir($backupPath)) or !is_writable($backupPath)){
if($backupPath === false || (!@mkdir($backupPath, 0777, true) && !is_dir($backupPath)) || !is_writable($backupPath)){
fwrite(STDERR, "Backup file path " . $args["backup"] . " is not writable (permission error or doesn't exist), aborting" . PHP_EOL);
exit(1);
}

View File

@ -88,7 +88,7 @@ function ping_server(\Socket $socket, string $serverIp, int $serverPort, int $ti
\GlobalLogger::get()->error("Error reading from socket: " . socket_strerror(socket_last_error($socket)));
return false;
}
if($recvAddr === $serverIp and $recvPort === $serverPort and $recvBuffer !== "" and ord($recvBuffer[0]) === MessageIdentifiers::ID_UNCONNECTED_PONG){
if($recvAddr === $serverIp && $recvPort === $serverPort && $recvBuffer !== "" && ord($recvBuffer[0]) === MessageIdentifiers::ID_UNCONNECTED_PONG){
$pong = new UnconnectedPong();
$pong->decode(new PacketSerializer($recvBuffer));
\GlobalLogger::get()->info("--- Response received ---");