$perm) $f->fwrite( json_encode([ $code, (int) $perm['id_user'], $perm['actions'] ]).PHP_EOL ); $f = null; /* [3] Get action list (with timeout) =========================================================*/ /* (1) Check data */ if( !isset($arr_r['actions']) || !is_array($arr_r['actions']) ){ slog('No \'actions\' found in response file', "$FEATURE:deploy", 'update'); return 127; } /* (2) Reset file */ file_put_contents(ACTIONS_CONF, ''); /* (3) Replace content */ $f = new SplFileObject(ACTIONS_CONF, 'w'); foreach($arr_r['actions'] as $timeout=>$actions) foreach($actions as $action) $f->fwrite( json_encode([ (int) $timeout, (int) $action['id_action'], $action['required'], $action['action'] ]).PHP_EOL ); $f = null; return 0; } /* Manage sync vs. sync */ $is_sync = false; if( $argc > 1 && $argv[1] == 'sync' ) $is_sync = true; $exec = rfid_read_deploy($is_sync); if( $exec == 0 ) slog('Success', "$FEATURE:deploy", 'update'); else slog('Failure', "$FEATURE:deploy", 'update'); echo $exec; die($exec); ?>