/** * Checks the status of a digital latch, or the status of an operation given as a parameter */ public static function checkLatchStatus() { $status = ""; global $wgUser; //mediawiki global var to get the userID that is currently logged into mediawiki $accountId = dbHelper::getAccountId($wgUser->getId()); if (isset($accountId) && !empty($accountId)) { $api = dbHelper::getLatchApi(); //create a Latch API instance $status = $api->status($accountId); //get the status of the latch for current user if (!empty($status) && $status->getData() != null) { $operations = $status->getData()->operations; $operation = $operations->{LatchConfig::appId}; $toRet = $operation->status; $toRet = (string) $toRet; return $toRet; //return $operation->status; } } return "on"; //other case return the latch status is open << if there's conectivity problems better to let it open than lock the user out }