New class "dbm" for the database management

This commit is contained in:
Michael Vogel 2016-06-01 07:04:31 +02:00
parent 16da854c2c
commit f07c96ee5f
2 changed files with 31 additions and 0 deletions

26
include/dbm.php Normal file
View file

@ -0,0 +1,26 @@
<?php
class dbm {
public static function processlist() {
$r = q("SHOW PROCESSLIST");
$s = array();
$states = array();
foreach ($r AS $process) {
$state = trim($process["State"]);
if (!in_array($state, array("", "init", "statistics")))
++$states[$state];
}
// query end
// Sending data
// updating
$statelist = "";
foreach ($states AS $state => $usage) {
if ($statelist != "")
$statelist .= ", ";
$statelist .= $state.": ".$usage;
}
return($statelist);
}
}
?>