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