. * * @link https://www.librenms.org * * @copyright 2022 Tony Murray * @author Tony Murray */ namespace LibreNMS\Validations\Poller; use LibreNMS\ValidationResult; class CheckLocking implements \LibreNMS\Interfaces\Validation { /** * @inheritDoc */ public function validate(): ValidationResult { try { $lock = \Cache::lock('dist_test_validation', 5); $lock->get(); $lock->release(); return ValidationResult::ok(trans('validation.validations.poller.CheckLocking.ok')); } catch (\Exception $e) { return ValidationResult::fail(trans('validation.validations.poller.CheckLocking.fail', ['message' => $e->getMessage()])); } } /** * @inheritDoc */ public function enabled(): bool { return true; } }