Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




win_is_writable [ WordPress Function ]

win_is_writable ( $path )
Parameters:
  • (string) $path
Returns:
  • (bool)
Defined at:



Workaround for Windows bug in is_writable() function

Source


<?php
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 uniqidmt_rand() ) . '.tmp');
    else if ( 
is_dir$path ) )
        return 
win_is_writable$path '/' uniqidmt_rand() ) . '.tmp' );
    
// check tmp file for read/write capabilities
    
$should_delete_tmp_file = !file_exists$path );
    
$f = @fopen$path'a' );
    if ( 
$f === false )
        return 
false;
    
fclose$f );
    if ( 
$should_delete_tmp_file )
        
unlink$path );
    return 
true;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics