update
This commit is contained in:
@@ -423,9 +423,50 @@ if ($type == "set_RTC_withBrowser") {
|
||||
|
||||
|
||||
if ($type == "clear_loopLogs") {
|
||||
$command = 'truncate -s 0 /var/www/nebuleair_pro_4g/logs/loop.log';
|
||||
$output = shell_exec($command);
|
||||
echo $output;
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$logPath = '/var/www/nebuleair_pro_4g/logs/master.log';
|
||||
|
||||
// Check if file exists and is writable
|
||||
if (!file_exists($logPath)) {
|
||||
throw new Exception("Log file does not exist");
|
||||
}
|
||||
|
||||
if (!is_writable($logPath)) {
|
||||
throw new Exception("Log file is not writable");
|
||||
}
|
||||
|
||||
// Execute the command
|
||||
$command = 'truncate -s 0 ' . escapeshellarg($logPath);
|
||||
$output = shell_exec($command . ' 2>&1');
|
||||
|
||||
// Check if there was any error output
|
||||
if (!empty($output)) {
|
||||
throw new Exception("Command error: " . $output);
|
||||
}
|
||||
|
||||
// Success response
|
||||
$response = array(
|
||||
'status' => 'success',
|
||||
'message' => 'Logs cleared successfully',
|
||||
'timestamp' => date('Y-m-d H:i:s')
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
// Error response
|
||||
$response = array(
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage(),
|
||||
'timestamp' => date('Y-m-d H:i:s')
|
||||
);
|
||||
}
|
||||
|
||||
// Set content type to JSON
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Return the JSON response
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($type == "database_size") {
|
||||
|
||||
Reference in New Issue
Block a user