note 92675 deleted from function.chown by danbrown

From: Date: Mon, 03 Aug 2009 19:40:53 +0000
Subject: note 92675 deleted from function.chown by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159061@lists.php.net to get a copy of this message
Note Submitter: david at ordal dot com ---- An improved recursive chown, based on nicolas@infosoft...'s recursive chmod. <?php function chownr($path, $uid) { if (!is_dir($path)) return chown($path, $uid); $dh = opendir($path); while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; if(is_link($fullpath)) return FALSE; elseif(!is_dir($fullpath) && !chown($fullpath, $uid)) return FALSE; elseif(!chownr($fullpath, $uid)) return FALSE; } } closedir($dh); if(chown($path, $uid)) return TRUE; else return FALSE; } ?>

« previous php.notes (#159061) next »