Project

General

Profile

Feature #12968 » diag_packet_capture.patch-v2.patch

Phil Wardt, 03/22/2022 02:13 PM

View differences:

src/usr/local/www/diag_packet_capture.php
277 277
			$action = gettext("Start");
278 278

  
279 279
			//delete previous packet capture if it exists
280
			if (file_exists($fp.$fn)) {
281
				unlink ($fp.$fn);
282
			}
283

  
280
			unlink_if_exists($fp.$fn);
284 281
		} elseif ($_POST['stopbtn'] != "") {
285 282
			$action = gettext("Stop");
286 283
			$processes_running = trim(shell_exec("/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep {$fn} | /usr/bin/egrep -v '(pflog|grep)'"));
......
297 294
		} elseif ($_POST['downloadbtn'] != "") {
298 295
			//download file
299 296
			send_user_download('file', $fp.$fn);
297
		} elseif ($_POST['clearbtn'] != "") {
298
			//delete previous packet capture if it exists
299
			unlink_if_exists($fp.$fn);
300 300
		}
301 301
	}
302 302
} else {
......
491 491
		null,
492 492
		'fa-download'
493 493
	))->addClass('btn-primary');
494

  
495
	$form->addGlobal(new Form_Button(
496
		'clearbtn',
497
		'Clear Capture',
498
		null,
499
		'fa-undo'
500
	))->addClass('btn-danger restore');
494 501

  
495 502
	if (file_exists($fp.$fns)) {
496 503
		$section->addInput(new Form_StaticText(
(3-3/4)