fixing error importing es language

This commit is contained in:
Fernando Ontiveros
2025-04-23 14:49:32 +00:00
parent e41c442d48
commit 6c5e7e6eca
4 changed files with 35 additions and 15 deletions

View File

@@ -3701,23 +3701,35 @@ class G
}
/**
* Recursive Is writeable function
* Recursively checks if all files in a directory are writable.
*
* @author Erik Amaru Ortiz <erik@colosa.com>
* This function scans the specified directory and checks the write permissions
* of all files that match the given pattern. If any file is not writable,
* the function returns false; otherwise, it returns true.
*
* @param $path path to scan recursively the write permission
* @param $pattern pattern to filter some specified files
* @return <boolean> if the $path, assuming that is a directory -> all files in it are writeables or not
* @param string $path The path to the directory to scan recursively.
* @param string $pattern The pattern to filter specific files (default is '*').
* @return bool Returns true if all files are writable, false otherwise.
* @throws InvalidArgumentException If the provided path is not a directory.
*/
public static function is_rwritable($path, $pattern = '*')
public static function is_rwritable(string $path, string $pattern = '*'): bool
{
// Check if the provided path is a directory
if (!is_dir($path)) {
throw new InvalidArgumentException("The provided path is not a directory: $path");
}
// Retrieve all files matching the pattern
$files = G::rglob($pattern, 0, $path);
// Check write permissions for each file
foreach ($files as $file) {
if (!is_writable($file)) {
return false;
return false; // Return false if any file is not writable
}
}
return true;
return true; // All files are writable
}
/**