Proper spacing in win_is_writable(), according to the coding standards

git-svn-id: https://develop.svn.wordpress.org/trunk@16622 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Nikolay Bachiyski 2010-11-30 19:13:27 +00:00
parent 17ad180ca0
commit 8a45977efc
1 changed files with 10 additions and 10 deletions

View File

@ -570,25 +570,25 @@ function saveDomDocument($doc, $filename) {
* @param object $path
* @return bool
*/
function win_is_writable($path) {
function win_is_writable( $path ) {
/* will work in despite of Windows ACLs bug
* NOTE: use a trailing slash for folders!!!
* see http://bugs.php.net/bug.php?id=27609
* see http://bugs.php.net/bug.php?id=30931
*/
if ( $path[strlen($path)-1] == '/' ) // recursively return a temporary file path
return win_is_writable($path . uniqid(mt_rand()) . '.tmp');
else if ( is_dir($path) )
return win_is_writable($path . '/' . uniqid(mt_rand()) . '.tmp');
if ( $path[strlen( $path ) - 1] == '/' ) // recursively return a temporary file path
return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
else if ( is_dir( $path ) )
return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
// check tmp file for read/write capabilities
$rm = file_exists($path);
$f = @fopen($path, 'a');
if ($f===false)
$rm = file_exists( $path );
$f = @fopen( $path, 'a' );
if ( $f === false )
return false;
fclose($f);
fclose( $f );
if ( ! $rm )
unlink($path);
unlink( $path );
return true;
}