is_writeable_ACLSafe()
from legolas558 d0t users dot sf dot net at http://www.php.net/is_writable
No Hooks.
Return
null
. Nothing (null).
Usage
is_writeable_ACLSafe( $path );
- $path (required)
- -
is_writeable_ACLSafe() is writeable ACLSafe code WPSCache 1.12.4
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( mt_rand() ) . '.tmp' ); } elseif ( is_dir( $path ) ) { return is_writeable_ACLSafe( $path . '/' . uniqid( mt_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; }