Revision a81a6edc
Added by Viktor Gurov almost 5 years ago
src/etc/rc.carpmaster | ||
---|---|---|
143 | 143 |
$rpc_client->setConnectionData($config['hasync']['synchronizetoip'], $xmlrpc_port, $xmlrpc_username, $config['hasync']['password']); |
144 | 144 |
$resp = $rpc_client->xmlrpc_method('captive_portal_sync', array('op' => 'get_databases', 'zone' => $cpzone)); |
145 | 145 |
|
146 |
if (is_array($resp)) { // $rep will be an array only if the communication was successful |
|
146 |
if (is_array($resp)) { // $resp will be an array only if the communication was successful
|
|
147 | 147 |
// Contains array of connected users (will be stored in SQLite DB) |
148 | 148 |
$connected_users = unserialize(base64_decode($resp['connected_users'])); |
149 | 149 |
// Contains array of active vouchers (will be stored in active vouchers db) |
150 | 150 |
$active_vouchers = unserialize(base64_decode($resp['active_vouchers'])); |
151 | 151 |
// Contain bitmask of both in use and expired vouchers (will be stored in "used vouchers" db) |
152 | 152 |
$expired_vouchers = unserialize(base64_decode($resp['expired_vouchers'])); |
153 |
// Contains array of usedmacs (will be stored in usedmacs db) |
|
154 |
$usedmacs = unserialize(base64_decode($resp['usedmacs'])); |
|
153 | 155 |
|
154 | 156 |
$cpdb = captiveportal_read_db(); |
155 | 157 |
$unsetindexes = array_column($cpdb, 5); |
... | ... | |
177 | 179 |
foreach ($active_vouchers as $roll => $vouchers) { |
178 | 180 |
voucher_write_active_db($roll, $vouchers); |
179 | 181 |
} |
182 |
captiveportal_write_usedmacs_db($usedmacs); |
|
180 | 183 |
} |
181 |
captiveportal_syslog(sprintf(gettext('Connected users and used vouchers have been synchronized from %1$s'), $config['hasync']['synchronizetoip']));
|
|
184 |
captiveportal_syslog(sprintf(gettext('Connected users, used vouchers and used MACs have been synchronized from %1$s'), $config['hasync']['synchronizetoip']));
|
|
182 | 185 |
} |
183 | 186 |
} |
184 | 187 |
openlog("", LOG_PID, LOG_LOCAL0); |
Also available in: Unified diff
Captive Portal UsedMACs sync. Issue #10857