Add apiDoc comments for the sanity endpoint
This commit is contained in:
15
api.php
15
api.php
@@ -679,10 +679,21 @@ if ($q == "getAddress") {
|
||||
|
||||
api_echo($acc->account2alias($account));
|
||||
} elseif ($q === 'sanity') {
|
||||
/**
|
||||
* @api {get} /api.php?q=sanity 20. sanity
|
||||
* @apiName sanity
|
||||
* @apiGroup API
|
||||
* @apiDescription Returns details about the node's sanity process.
|
||||
*
|
||||
* @apiSuccess {object} data A collection of data about the sanity process.
|
||||
* @apiSuccess {boolean} data.sanity_running Whether the sanity process is currently running.
|
||||
* @apiSuccess {number} data.last_sanity The timestamp for the last time the sanity process was run.
|
||||
* @apiSuccess {boolean} data.sanity_sync Whether the sanity process is currently synchronising.
|
||||
*/
|
||||
$sanity = file_exists(__DIR__.'/tmp/sanity-lock');
|
||||
|
||||
$lastSanity = $db->single("SELECT val FROM config WHERE cfg='sanity_last'");
|
||||
$sanitySync = $db->single("SELECT val FROM config WHERE cfg='sanity_sync'");
|
||||
$lastSanity = (int)$db->single("SELECT val FROM config WHERE cfg='sanity_last'");
|
||||
$sanitySync = (bool)$db->single("SELECT val FROM config WHERE cfg='sanity_sync'");
|
||||
api_echo(['sanity_running' => $sanity, 'last_sanity' => $lastSanity, 'sanity_sync' => $sanitySync]);
|
||||
} elseif ($q=="node-info"){
|
||||
$dbversion=$db->single("SELECT val FROM config WHERE cfg='dbversion'");
|
||||
|
||||
Reference in New Issue
Block a user