Skip to content

Commit

Permalink
Remove permissions from Diagnostics panel when on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbj committed Feb 5, 2018
1 parent 0c5e41b commit 8c87c5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TracyDebugger.module
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
'summary' => __('Tracy debugger from Nette with several PW specific custom tools.', __FILE__),
'author' => 'Adrian Jones',
'href' => 'https://processwire.com/talk/topic/12208-tracy-debugger/',
'version' => '4.9.12',
'version' => '4.9.13',
'autoload' => true,
'singular' => true,
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
Expand Down
14 changes: 9 additions & 5 deletions panels/DiagnosticsPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ protected function generateFilesystem() {
'Sessions Directory'
);

// posix_getpwuid doesn't exist on Windows so don't add Owner column
// posix_getpwuid doesn't exist on Windows so don't add Owner & Permission columns
if(function_exists('posix_getpwuid')) {
$this->filesystem = $this->sectionHeader(array('Attribute', 'Path', 'Exists', 'Readable', 'Writeable', 'Permissions', 'Owner (User:Group)', 'Status', 'Notes'));
}
else {
$this->filesystem = $this->sectionHeader(array('Attribute', 'Path', 'Exists', 'Readable', 'Writeable', 'Permissions', 'Status', 'Notes'));
$this->filesystem = $this->sectionHeader(array('Attribute', 'Path', 'Exists', 'Readable', 'Writeable', 'Status', 'Notes'));
}

foreach($attributes as $attribute) {
Expand Down Expand Up @@ -202,8 +202,11 @@ protected function buildAttrRow($attribute) {
<td title='".$this->getPaths($attribute)."'>".$this->getPaths($attribute, true)."</td>
<td>".$exists."</td>
<td>".$readable."</td>
<td>".$writeable."</td>
<td>".$permission."</td>";
<td>".$writeable."</td>";
// posix_getpwuid doesn't exist on Windows so don't add Permission column
if(function_exists('posix_getpwuid')) {
$out .= "<td>".$permission."</td>";
}
if(isset($owner)) {
$out .= "<td>".(!empty($owner) ? $owner['name'].":".$group['name'] : '')."</td>";
}
Expand All @@ -220,7 +223,8 @@ protected function buildAttrRow($attribute) {
* return an array with status and notes items
*/
protected function getStatusNotes($attribute, $exists, $readable, $writeable, $permission) {
if($permission == '0777') {
// also check if NOT on Windows by using presence of posix_getpwuid
if($permission == '0777' && function_exists('posix_getpwuid')) {
return array('Failure', '0777 is usually unsafe');
}
else {
Expand Down

0 comments on commit 8c87c5f

Please sign in to comment.