is_writeable_ACLSafe()
No Hooks.
Returns
null. Nothing (null).
Usage
is_writeable_ACLSafe( $path );
- $path(string) (required)
- .
is_writeable_ACLSafe() is writeable ACLSafe code WPSCache 3.1.1
function is_writeable_ACLSafe( $path ) {
if (
( defined( 'PHP_OS_FAMILY' ) && 'Windows' !== constant( 'PHP_OS_FAMILY' ) ) ||
stristr( PHP_OS, 'DAR' ) ||
! stristr( PHP_OS, 'WIN' )
) {
return is_writable( $path );
}
// PHP's is_writable does not work with Win32 NTFS
if ( $path[ strlen( $path ) - 1 ] === '/' ) { // recursively return a temporary file path
return is_writeable_ACLSafe( $path . uniqid( (string) wp_rand() ) . '.tmp' );
} elseif ( is_dir( $path ) ) {
return is_writeable_ACLSafe( $path . '/' . uniqid( (string) wp_rand() ) . '.tmp' );
}
// check tmp file for read/write capabilities
$rm = file_exists( $path );
$f = @fopen( $path, 'a' );
if ( $f === false ) {
return false;
}
fclose( $f );
if ( ! $rm ) {
unlink( $path );
}
return true;
}