Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
debugpanel: small improvements and added access to gphoto logs (PR #277)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacques42 committed Jul 30, 2021
1 parent 1c92ecd commit 9186b0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions admin/debugpanel.php
Expand Up @@ -89,6 +89,7 @@ function html_src_indent($num)
echo '<li><a class="adminnavlistelement" href="#myconfig" id="nav-myconfig"><div><span data-i18n="myconfig">myconfig</span></div></a></li>';
echo '<li><a class="adminnavlistelement" href="#remotebuzzerlog" id="nav-remotebuzzerlog"><div><span data-i18n="remotebuzzer">remotebuzzer</span></div></a></li>';
echo '<li><a class="adminnavlistelement" href="#synctodrivelog" id="nav-synctodrivelog"><div><span data-i18n="synctodrive">synctodrive</span></div></a></li>';
echo '<li><a class="adminnavlistelement" href="#cameralog" id="nav-cameralog"><div><span data-i18n="cameralog">cameralog</span></div></a></li>';
echo '<li><a class="adminnavlistelement" href="#serverprocesses" id="nav-serverprocesses"><div><span data-i18n="serverprocesses">serverprocesses</span></div></a></li>';
echo '<li><a class="adminnavlistelement" href="#bootconfig" id="nav-bootconfig"><div><span data-i18n="bootconfig">bootconfig</span></div></a></li>';

Expand Down
20 changes: 15 additions & 5 deletions api/serverInfo.php
Expand Up @@ -9,11 +9,11 @@

switch ($content) {
case 'nav-remotebuzzerlog':
echo dumpfile($config['foldersAbs']['tmp'] . '/' . $config['remotebuzzer']['logfile']);
echo dumpfile($config['foldersAbs']['tmp'] . '/' . $config['remotebuzzer']['logfile'], true);
break;

case 'nav-synctodrivelog':
echo dumpfile($config['foldersAbs']['tmp'] . '/' . $config['synctodrive']['logfile']);
echo dumpfile($config['foldersAbs']['tmp'] . '/' . $config['synctodrive']['logfile'], true);
break;

case 'nav-myconfig':
Expand All @@ -25,15 +25,25 @@
break;

case 'nav-bootconfig':
echo dumpfile('/boot/config.txt');
echo dumpfile('/boot/config.txt', null);
break;

case 'nav-cameralog':
echo dumpfile($config['foldersAbs']['tmp'] . '/' . $config['take_picture']['logfile'], false);
break;

default:
echo 'UNKNOWN COMMAND';
echo 'Unknown debug panel parameter';
break;
}

function dumpfile($file) {
function dumpfile($file, $devModeRequired) {
global $config;

if ($devModeRequired !== null && $config['dev']['enabled'] !== $devModeRequired) {
return 'INFO: Dev mode is ' . ($config['dev']['enabled'] ? 'enabled - please disable' : 'disabled - please enable') . ' to see logs';
}

if (!file_exists($file)) {
return 'INFO: File (' . $file . ') does not exist';
} elseif (!is_file($file)) {
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en.json
@@ -1,5 +1,6 @@
{
"abort": "Abort",
"cameralog": "gphoto logs",
"admin_panel": "Admin panel",
"adminpanel_back": "Back",
"adminpanel_toggletextOFF": "Off",
Expand Down

0 comments on commit 9186b0d

Please sign in to comment.