Make the operation of saving old rule nearby the writing operation to be logical to spot

This commit is contained in:
Ermal 2013-09-04 08:18:51 +00:00
parent b214bf3a05
commit dc8b4c4ec6

View File

@ -239,10 +239,6 @@ function filter_configure_sync($delete_states_if_needed = true) {
return;
}
// Copy rules.debug to rules.debug.old
if(file_exists("{$g['tmp_path']}/rules.debug"))
@copy("{$g['tmp_path']}/rules.debug", "{$g['tmp_path']}/rules.debug.old");
$limitrules = "";
/* Define the maximum number of tables the system can handle (should be at least aliases*2+some spare) */
$maxtables = is_numeric($config['system']['maximumtables']) ? $config['system']['maximumtables'] : "3000";
@ -299,6 +295,10 @@ function filter_configure_sync($delete_states_if_needed = true) {
unset($aliases, $gateways, $altq_queues, $natrules, $pfrules);
// Copy rules.debug to rules.debug.old
if(file_exists("{$g['tmp_path']}/rules.debug"))
@copy("{$g['tmp_path']}/rules.debug", "{$g['tmp_path']}/rules.debug.old");
if (!@file_put_contents("{$g['tmp_path']}/rules.debug", $rules, LOCK_EX)) {
log_error("WARNING: Could not write new rules!");
unlock($filterlck);