Project

General

Profile

« Previous | Next » 

Revision 4f7956ad

Added by Steve Beaver over 8 years ago

Revise update_filter_relaod_status() function to append status messages rather than overwrite the file

View differences:

src/etc/inc/filter.inc
232 232
	$filterlck = lock('filter', LOCK_EX);
233 233

  
234 234
	filter_pflog_start();
235
	update_filter_reload_status(gettext("Initializing"));
235
	update_filter_reload_status(gettext("Initializing"), true);  // second argument = overwrite existing file
236 236

  
237 237
	/* invalidate interface cache */
238 238
	get_interface_arr(true);
src/etc/inc/util.inc
807 807
		return 0;
808 808
	}
809 809

  
810
	// 2**N returns an exact result as an INT if possible, and a float/double if not. 
810
	// 2**N returns an exact result as an INT if possible, and a float/double if not.
811 811
	// Detect this switch, rather than comparing $result<=PHP_MAX_INT or $bits >=8*PHP_INT_SIZE as it's (probably) easier to get completely reliable
812 812
	$result = 2 ** $snsize;
813
	
813

  
814 814
	if ($exact && !is_int($result)) {
815 815
		//exact required but can't represent result exactly as an INT
816 816
		return 0;
......
850 850
	$largest_sn = min($bits1, $bits2);
851 851
	$subnetv4_start1 = gen_subnetv4($subnet1, $largest_sn);
852 852
	$subnetv4_start2 = gen_subnetv4($subnet2, $largest_sn);
853
	
853

  
854 854
	if ($subnetv4_start1 == '' || $subnetv4_start2 == '') {
855 855
		// One or both args is not a valid IPv4 subnet
856 856
		//FIXME: needs to return "bad data" not true/false if bad. For now return false, best we can do until fixed
......
865 865
	$largest_sn = min($bits1, $bits2);
866 866
	$subnetv6_start1 = gen_subnetv6($subnet1, $largest_sn);
867 867
	$subnetv6_start2 = gen_subnetv6($subnet2, $largest_sn);
868
	
868

  
869 869
	if ($subnetv6_start1 == '' || $subnetv6_start2 == '') {
870 870
		// One or both args is not a valid IPv6 subnet
871 871
		//FIXME: needs to return "bad data" not true/false if bad. For now return false, best we can do until fixed
......
1863 1863
	return ("$num {$units[$i]}");
1864 1864
}
1865 1865

  
1866
function update_filter_reload_status($text) {
1866
function update_filter_reload_status($text, $new=false) {
1867 1867
	global $g;
1868 1868

  
1869
	file_put_contents("{$g['varrun_path']}/filter_reload_status", $text);
1869
	if ($new) {
1870
		file_put_contents("{$g['varrun_path']}/filter_reload_status", $text  . PHP_EOL);
1871
	} else {
1872
		file_put_contents("{$g['varrun_path']}/filter_reload_status", $text  . PHP_EOL, FILE_APPEND);
1873
	}
1870 1874
}
1871 1875

  
1872 1876
/****** util/return_dir_as_array
src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
630 630
	/* And we're no longer dirty! */
631 631
	clear_subsystem_dirty('shaper');
632 632

  
633
	update_filter_reload_status("Initializing");
634 633
	header("Location: status_filter_reload.php");
635 634
	exit;
636 635
}
src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc
696 696
	/* And we're no longer dirty! */
697 697
	clear_subsystem_dirty('shaper');
698 698

  
699
	update_filter_reload_status("Initializing");
700 699
	header("Location: status_filter_reload.php");
701 700
	exit;
702 701
}

Also available in: Unified diff