mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-25 09:00:25 +00:00
Replace literal w/ RASPI_DEBUG_LOG
This commit is contained in:
parent
98d5f5b64b
commit
86ac3e2ff6
4 changed files with 7 additions and 6 deletions
|
@ -7,17 +7,16 @@ if (isset($_POST['csrf_token'])) {
|
|||
if (csrfValidateRequest() && !CSRFValidate()) {
|
||||
handleInvalidCSRFToken();
|
||||
}
|
||||
exec( RASPI_CONFIG.'/system/debuglog.sh', $return);
|
||||
$root = getenv("DOCUMENT_ROOT");
|
||||
exec( RASPI_CONFIG.'/system/debuglog.sh -i '.$root, $return);
|
||||
|
||||
$logOutput = implode(PHP_EOL, $return);
|
||||
$filename = "raspap_debug.log";
|
||||
$tempDir = sys_get_temp_dir();
|
||||
$filePath = $tempDir . DIRECTORY_SEPARATOR . $filename;
|
||||
$filePath = $tempDir . DIRECTORY_SEPARATOR . RASPI_DEBUG_LOG;
|
||||
$handle = fopen($filePath, "w");
|
||||
fwrite($handle, $logOutput);
|
||||
fclose($handle);
|
||||
echo json_encode($filePath);
|
||||
|
||||
} else {
|
||||
handleInvalidCSRFToken();
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
require '../../includes/csrf.php';
|
||||
require_once '../../includes/config.php';
|
||||
|
||||
$filePath = $_GET['filePath'];
|
||||
$filename = "raspap_debug.log";
|
||||
|
||||
if (isset($filePath) && strpos($filePath, $filename) !== false) {
|
||||
if (isset($filePath) && strpos($filePath, RASPI_DEBUG_LOG) !== false) {
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename='.basename($filePath));
|
||||
header('Expires: 0');
|
||||
|
|
|
@ -7,6 +7,7 @@ define('RASPI_CONFIG_PROVIDERS', 'config/vpn-providers.json');
|
|||
define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth');
|
||||
define('RASPI_WIFI_AP_INTERFACE', 'wlan0');
|
||||
define('RASPI_CACHE_PATH', sys_get_temp_dir() . '/raspap');
|
||||
define('RASPI_DEBUG_LOG', 'raspap_debug.log');
|
||||
|
||||
// Constants for configuration file paths.
|
||||
// These are typical for default RPi installs. Modify if needed.
|
||||
|
|
|
@ -12,6 +12,7 @@ $defaults = [
|
|||
'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth',
|
||||
'RASPI_WIFI_AP_INTERFACE' => 'wlan0',
|
||||
'RASPI_CACHE_PATH' => sys_get_temp_dir() . '/raspap',
|
||||
'RASPI_DEBUG_LOG' => 'raspap_debug.log',
|
||||
|
||||
// Constants for configuration file paths.
|
||||
// These are typical for default RPi installs. Modify if needed.
|
||||
|
|
Loading…
Reference in a new issue