3 * @brief This class contain functions for the database management
8 * @brief Return a list of database processes
11 * 'list' => List of processes, separated in their different states
12 * 'amount' => Number of concurrent database processes
14 public static function processlist() {
15 $r = q("SHOW PROCESSLIST");
20 foreach ($r AS $process) {
21 $state = trim($process["State"]);
23 // Filter out all non blocking processes
24 if (!in_array($state, array("", "init", "statistics", "updating"))) {
31 foreach ($states AS $state => $usage) {
34 $statelist .= $state.": ".$usage;
36 return(array("list" => $statelist, "amount" => $processes));
40 * Checks if $array is a filled array with at least one entry.
42 * @param $array mixed A filled array with at least one entry
43 * @return Whether $array is a filled array
45 public static function is_result($array) {
46 return (is_array($array) && count($array) > 0);