From a8ced10b3602043c723123fecd83b4da61a204ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ermal=20Lu=E7i?= Date: Tue, 30 Jun 2009 17:18:59 +0000 Subject: Convert even voucher to the new subsystem_dirty functions. This reduces another global. --- etc/inc/voucher.inc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'etc/inc/voucher.inc') diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 0bcc8ce..3c4fbe8 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -28,7 +28,6 @@ /* include all configuration functions */ require_once("config.inc"); -$voucher_dirtyfile = "{$g['varrun_path']}/voucher.dirty"; /* *Authenticate a voucher and return the remaining time credit in minutes @@ -37,7 +36,7 @@ $voucher_dirtyfile = "{$g['varrun_path']}/voucher.dirty"; */ function voucher_auth($voucher_received, $test = 0) { - global $g, $config, $voucher_dirtyfile; + global $g, $config; // if $test is set, simply test the voucher. Don't change anything // but return a more verbose error and result message back @@ -163,8 +162,7 @@ function voucher_auth($voucher_received, $test = 0) { voucher_write_active_db($roll, $active_vouchers[$first_voucher_roll]); // mark the DB's as dirty. - if ($fd = fopen($voucher_dirtyfile, "w")) - fclose($fd); + mark_subsystem_dirty('voucher'); unlock($voucherlck); @@ -369,12 +367,12 @@ function voucher_log($priority, $message) { */ function voucher_save_db_to_config() { - global $config, $g, $voucher_dirtyfile; + global $config, $g; if (!isset($config['voucher']['enable']) || $config['voucher']['saveinterval'] == 0) return; // no vouchers or don't want to save DB's - if (!file_exists($voucher_dirtyfile)) + if (!is_subsystem_dirty('voucher')) return; // nothing changed. $voucherlck = lock('voucher'); @@ -398,7 +396,7 @@ function voucher_save_db_to_config() { } $rollent['active'] = $db; } - unlink($voucher_dirtyfile); + clear_subsystem_dirty('voucher'); unlock($voucherlck); write_config(); return; -- cgit v1.1