File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1616use function getenv ;
1717use function getmyuid ;
1818use function in_array ;
19+ use function is_dir ;
20+ use function is_writable ;
21+ use function mkdir ;
1922use function php_uname ;
2023use function posix_getuid ;
2124use function putenv ;
@@ -287,4 +290,19 @@ public static function isInteractive($fileDescriptor): bool
287290 {
288291 return function_exists ('posix_isatty ' ) && @posix_isatty ($ fileDescriptor );
289292 }
293+
294+ /**
295+ * Support the creation of hierarchical directories
296+ *
297+ * @param string $path
298+ * @param int $mode
299+ * @param bool $recursive
300+ *
301+ * @return bool
302+ */
303+ public static function mkdir (string $ path , int $ mode = 0775 , bool $ recursive = true ): bool
304+ {
305+ return (is_dir ($ path ) || !(!@mkdir ($ path , $ mode , $ recursive ) && !is_dir ($ path ))) && is_writable ($ path );
306+ }
307+
290308}
You can’t perform that action at this time.
0 commit comments