diff --git a/lib/Froxlor/Api/Commands/Froxlor.php b/lib/Froxlor/Api/Commands/Froxlor.php index 709cffe2..080676d6 100644 --- a/lib/Froxlor/Api/Commands/Froxlor.php +++ b/lib/Froxlor/Api/Commands/Froxlor.php @@ -243,6 +243,26 @@ class Froxlor extends \Froxlor\Api\ApiCommand return $this->response(200, "successfull", \Froxlor\System\Crypt::generatePassword()); } + /** + * can be used to remotely run the integritiy checks froxlor implements + * + * @access admin + * @throws \Exception + * @return string + */ + public function integrityCheck() + { + if ($this->isAdmin() && $this->getUserDetail('change_serversettings')) { + $integrity = new \Froxlor\Database\IntegrityCheck(); + $result = $integrity->checkAll(); + if ($result) { + return $this->response(200, "successfull", "OK"); + } + throw new \Exception("Some checks failed.", 406); + } + throw new \Exception("Not allowed to execute given command.", 403); + } + /** * returns a list of all available api functions *