本文整理汇总了PHP中FileSystem::perm_compare方法的典型用法代码示例。如果您正苦于以下问题:PHP FileSystem::perm_compare方法的具体用法?PHP FileSystem::perm_compare怎么用?PHP FileSystem::perm_compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem::perm_compare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFile
function CheckFile($path, $type = 'dir')
{
$current = '?';
$expected = '777';
$euid = '?';
if (FileSystem::HasFunctions()) {
$current = @substr(decoct(@fileperms($path)), -3);
if ($type == 'file') {
$expected = FileSystem::getExpectedPerms_file($path);
} else {
$expected = FileSystem::getExpectedPerms($path);
}
if (FileSystem::perm_compare($expected, $current)) {
$this->passed_count++;
return;
}
$euid = FileSystem::file_uid($path);
} elseif (gp_is_writable($path)) {
$this->passed_count++;
return;
}
$this->failed_count++;
if ($this->failed_count > $this->show_failed_max) {
return;
}
echo '<tr><td>';
echo substr($path, $this->check_dir_len);
echo '</td><td>';
echo $current;
echo '</td><td>';
echo $expected;
echo '</td><td>';
echo $euid;
echo '</td><td>';
echo $this->euid;
echo '</td></tr>';
}
示例2: CheckDataFolder
function CheckDataFolder()
{
global $ok, $dataDir, $langmessage;
echo '<tr>';
echo '<td class="nowrap">';
$folder = $dataDir . '/data';
if (strlen($folder) > 23) {
$show = '...' . substr($folder, -20);
} else {
$show = $folder;
}
echo sprintf($langmessage['Permissions_for'], $show);
echo ' ';
echo '</td>';
if (!is_dir($folder)) {
if (!@mkdir($folder, 0777)) {
echo '<td class="passed_orange">' . $langmessage['See_Below'] . ' (0)</td>';
$this->can_write_data = $ok = false;
} else {
echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
}
} elseif (gp_is_writable($folder)) {
echo '<td class="passed">' . $langmessage['Passed'] . '</td>';
} else {
echo '<td class="passed_orange">' . $langmessage['See_Below'] . ' (1)</td>';
$this->can_write_data = $ok = false;
}
//show current info
$expected = '777';
if (file_exists($folder) && ($current = @substr(decoct(fileperms($folder)), -3))) {
$expected = FileSystem::getExpectedPerms($folder);
if (FileSystem::perm_compare($expected, $current)) {
echo '<td class="passed">';
echo $current;
} else {
echo '<td class="passed_orange">';
echo $current;
}
} else {
echo '<td class="passed_orange">';
echo '???';
}
echo '</td>';
echo '<td>';
echo $expected;
echo '</td>';
echo '</tr>';
}