Skip to content

Instantly share code, notes, and snippets.

@roelven
Created April 19, 2010 12:35
Show Gist options
  • Save roelven/370993 to your computer and use it in GitHub Desktop.
Save roelven/370993 to your computer and use it in GitHub Desktop.
A function to check the permissions of a folder using PHP
<?php
// A function to check the permissions of a folder using PHP
// @path = path to the folder you want to check
// @perm = permissions you want to check on the folder (0755)
function ynbs_check_permissions($path, $perm) {
clearstatcache();
$configmod = @substr(sprintf(".%o", fileperms($path)), -4);
if ($configmod != $perm) {
return '<div class="error"><p>Warning, the permissions of your XML directory are now '.$configmod.'. You should set them to <strong>'.$perm.'</strong></p></div>';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment