File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -677,14 +677,14 @@ public function _getLogData($log, $max_lines = 100) {
677677 $ log = 'Logfile path error. ' ;
678678 } else {
679679 if (is_readable ($ logfile )) {
680- $ log = $ this ->_getOutputFromExecCommand ('tail -n ' .intval ($ max_lines ).' ' . escapeshellarg ($ logfile ));
680+ $ log = $ this ->_getOutputFromExecCommand ('tail -n ' .intval ($ max_lines ).' ' . escapeshellarg ($ logfile ), $ max_lines );
681681 } else {
682682 $ log = 'Unable to read ' . $ logfile ;
683683 }
684684 }
685685 } else {
686686 if ($ journalmatch != '' ){
687- $ log = $ this ->_getOutputFromExecCommand ('journalctl -n ' .intval ($ max_lines ).' --no-pager ' . escapeshellcmd ($ journalmatch ));
687+ $ log = $ this ->_getOutputFromExecCommand ('journalctl -n ' .intval ($ max_lines ).' --no-pager ' . escapeshellcmd ($ journalmatch ), $ max_lines );
688688 }else {
689689 $ log = 'Unable to read logfile ' ;
690690 }
@@ -694,15 +694,15 @@ public function _getLogData($log, $max_lines = 100) {
694694 return $ log ;
695695 }
696696
697- private function _getOutputFromExecCommand ($ command ) {
697+ private function _getOutputFromExecCommand ($ command, $ max4k = 1000 ) {
698698 $ log = '' ;
699699 $ fd = popen ($ command , 'r ' );
700700 if ($ fd ) {
701701 $ n = 0 ;
702702 while (!feof ($ fd )) {
703703 $ log .= fgets ($ fd , 4096 );
704704 $ n ++;
705- if ($ n > 1000 )
705+ if ($ n > $ max4k )
706706 break ;
707707 }
708708 fclose ($ fd );
You can’t perform that action at this time.
0 commit comments