| 381 | } |
| 382 | |
| 383 | static void job_to_json(md_json_t *json, const md_job_t *job, |
| 384 | md_result_t *result, apr_pool_t *p) |
| 385 | { |
| 386 | char ts[APR_RFC822_DATE_LEN]; |
| 387 | |
| 388 | md_json_sets(job->mdomain, json, MD_KEY_NAME, NULL); |
| 389 | md_json_setb(job->finished, json, MD_KEY_FINISHED, NULL); |
| 390 | md_json_setb(job->notified, json, MD_KEY_NOTIFIED, NULL); |
| 391 | md_json_setb(job->notified_renewed, json, MD_KEY_NOTIFIED_RENEWED, NULL); |
| 392 | if (job->next_run > 0) { |
| 393 | apr_rfc822_date(ts, job->next_run); |
| 394 | md_json_sets(ts, json, MD_KEY_NEXT_RUN, NULL); |
| 395 | } |
| 396 | if (job->last_run > 0) { |
| 397 | apr_rfc822_date(ts, job->last_run); |
| 398 | md_json_sets(ts, json, MD_KEY_LAST_RUN, NULL); |
| 399 | } |
| 400 | if (job->valid_from > 0) { |
| 401 | apr_rfc822_date(ts, job->valid_from); |
| 402 | md_json_sets(ts, json, MD_KEY_VALID_FROM, NULL); |
| 403 | } |
| 404 | md_json_setl(job->error_runs, json, MD_KEY_ERRORS, NULL); |
| 405 | if (!result) result = job->last_result; |
| 406 | if (result) { |
| 407 | md_json_setj(md_result_to_json(result, p), json, MD_KEY_LAST, NULL); |
| 408 | } |
| 409 | if (job->log) md_json_setj(job->log, json, MD_KEY_LOG, NULL); |
| 410 | } |
| 411 | |
| 412 | apr_status_t md_job_load(md_job_t *job) |
| 413 | { |
no test coverage detected