示例#1
0
use Ampersand\Rule\Conjunct;
use Ampersand\Rule\Rule;
use Ampersand\Core\Relation;
use Ampersand\Core\Atom;
use Ampersand\Core\Concept;
use Ampersand\Output\OutputCSV;
global $app;
$app->get('/admin/installer', function () use($app) {
    if (Config::get('productionEnv')) {
        throw new Exception("Database reinstall not allowed in production environment", 403);
    }
    $defaultPop = filter_var($app->request->params('defaultPop'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
    if (is_null($defaultPop)) {
        $defaultPop = true;
    }
    Database::createDB();
    $db = Database::singleton();
    $db->reinstallDB($defaultPop);
    $session = Session::singleton();
    $roleIds = $app->request->params('roleIds');
    $session->activateRoles($roleIds);
    $content = Notifications::getAll();
    // Return all notifications
    print json_encode($content, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
});
$app->get('/admin/checks/rules/evaluate/all', function () use($app) {
    if (Config::get('productionEnv')) {
        throw new Exception("Database reinstall not allowed in production environment", 403);
    }
    foreach (Rule::getAllInvRules() as $rule) {
        foreach ($rule->getViolations() as $violation) {