本文整理汇总了PHP中Monitor::_getOwnerAndGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Monitor::_getOwnerAndGroup方法的具体用法?PHP Monitor::_getOwnerAndGroup怎么用?PHP Monitor::_getOwnerAndGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::_getOwnerAndGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkConfiguration
/**
* Checks on the status of the required configuration and auxiliary files
* and directories.
*
* @access public
* @param array $required_files An array of files that should be checked on.
*/
function checkConfiguration($required_files)
{
foreach ($required_files as $file_path => $options) {
// check if file exists
if (!file_exists($file_path)) {
echo "ERROR: File could not be found (path: {$file_path})\n";
continue;
}
// check the owner and group for these files
list($owner, $group) = Monitor::_getOwnerAndGroup($file_path);
if (@$options['check_owner'] && $options['owner'] != $owner) {
echo "ERROR: File owner mismatch (path: {$file_path}; current owner: {$owner}; correct owner: " . $options['owner'] . ")\n";
}
if (@$options['check_group'] && $options['group'] != $group) {
echo "ERROR: File group mismatch (path: {$file_path}; current group: {$group}; correct group: " . $options['group'] . ")\n";
}
// check permission bits
$perm = Monitor::_getOctalPerms($file_path);
if (@$options['check_permission'] && $options['permission'] != $perm) {
echo "ERROR: File permission mismatch (path: {$file_path}; current perm: {$perm}; correct perm: " . $options['permission'] . ")\n";
}
// check filesize
if (@$options['check_filesize'] && filesize($file_path) < $options['filesize']) {
echo "ERROR: File size mismatch (path: {$file_path}; current filesize: " . filesize($file_path) . ")\n";
}
}
$required_directories = array(APP_PATH . 'misc/routed_emails' => array('check_permission' => true, 'permission' => 770), APP_PATH . 'misc/routed_notes' => array('check_permission' => true, 'permission' => 770), APP_PATH . 'setup' => array('check_permission' => true, 'permission' => 100));
foreach ($required_directories as $dir_path => $options) {
// check if directory exists
if (!file_exists($dir_path)) {
echo "ERROR: Directory could not be found (path: {$dir_path})\n";
continue;
}
// check permission bits
$perm = Monitor::_getOctalPerms($dir_path);
if (@$options['check_permission'] && $options['permission'] != $perm) {
echo "ERROR: Directory permission mismatch (path: {$dir_path}; current perm: {$perm}; correct perm: " . $options['permission'] . ")\n";
}
}
}