mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:00:16 +00:00
New class "dbm" for the database management
This commit is contained in:
parent
16da854c2c
commit
f07c96ee5f
2 changed files with 31 additions and 0 deletions
26
include/dbm.php
Normal file
26
include/dbm.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -41,6 +41,7 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("include/dba.php");
|
require_once("include/dba.php");
|
||||||
|
require_once("include/dbm.php");
|
||||||
|
|
||||||
if(!$install) {
|
if(!$install) {
|
||||||
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
|
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
|
||||||
|
@ -53,6 +54,10 @@ if(!$install) {
|
||||||
load_config('config');
|
load_config('config');
|
||||||
load_config('system');
|
load_config('system');
|
||||||
|
|
||||||
|
$processlist = dbm::processlist();
|
||||||
|
if ($processlist != "")
|
||||||
|
logger("Processlist: ".$processlist, LOGGER_DEBUG);
|
||||||
|
|
||||||
$maxsysload_frontend = intval(get_config('system','maxloadavg_frontend'));
|
$maxsysload_frontend = intval(get_config('system','maxloadavg_frontend'));
|
||||||
if($maxsysload_frontend < 1)
|
if($maxsysload_frontend < 1)
|
||||||
$maxsysload_frontend = 50;
|
$maxsysload_frontend = 50;
|
||||||
|
|
Loading…
Reference in a new issue