Added documentation

This commit is contained in:
Michael Vogel 2016-06-06 06:29:03 +02:00
parent a25d58b2ee
commit 3d27ebcb34
1 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,16 @@
<?php <?php
/**
* @brief This class contain functions for the database management
*
*/
class dbm { class dbm {
/**
* @brief Return a list of database processes
*
* @return array
* 'list' => List of processes, separated in their different states
* 'amount' => Number of concurrent database processes
*/
public static function processlist() { public static function processlist() {
$r = q("SHOW PROCESSLIST"); $r = q("SHOW PROCESSLIST");
$s = array(); $s = array();
@ -8,14 +19,13 @@ class dbm {
$states = array(); $states = array();
foreach ($r AS $process) { foreach ($r AS $process) {
$state = trim($process["State"]); $state = trim($process["State"]);
// Filter out all idle processes
if (!in_array($state, array("", "init", "statistics"))) { if (!in_array($state, array("", "init", "statistics"))) {
++$states[$state]; ++$states[$state];
++$processes; ++$processes;
} }
} }
// query end
// Sending data
// updating
$statelist = ""; $statelist = "";
foreach ($states AS $state => $usage) { foreach ($states AS $state => $usage) {