kritbit

kritbit Git Source Tree


Root/web/kritbit.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
 
spl_autoload_extensions(".php"); // comma-separated list
spl_autoload_register();
 
foreach (glob("system/vendor/*.php") as $filename)
{
    include $filename;
}
 
if (!is_cli()) {
    die("This script must be ran from the command line");
}
 
$core = new \system\engine\HF_Core(true);
$core->setupDatabaseConnection();
 
if (count($argv) == 1) {
    echo "Possible commands are all-clear or adduser";
    exit(0);
}
 
switch ($argv[1]) {
    case "all-clear":
        \vendor\DB\DB::query("DELETE FROM histories");
        \vendor\DB\DB::query("DELETE FROM users");
        \vendor\DB\DB::query("DELETE FROM sessions");
        \vendor\DB\DB::query("DELETE FROM jobs");
        break;
    case "adduser":
        $user = $argv[2];
        \vendor\DB\DB::query("INSERT INTO users VALUES (null, ?)", [$user]);
        break;
}

Archive Download this file

Branches

Number of commits:
Page rendered in 0.20753s using 11 queries.