]> git.mxchange.org Git - friendica.git/commitdiff
New class "dbm" for the database management
authorMichael Vogel <icarus@dabo.de>
Wed, 1 Jun 2016 05:04:31 +0000 (07:04 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 1 Jun 2016 05:04:31 +0000 (07:04 +0200)
include/dbm.php [new file with mode: 0644]
index.php

diff --git a/include/dbm.php b/include/dbm.php
new file mode 100644 (file)
index 0000000..f68987c
--- /dev/null
@@ -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);
+       }
+}
+?>
index 73f46cfbef2367570be09c6985e9605568c0801e..ec72771341807bbd56260dd92887d4cd85470df8 100644 (file)
--- a/index.php
+++ b/index.php
@@ -41,6 +41,7 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
  */
 
 require_once("include/dba.php");
+require_once("include/dbm.php");
 
 if(!$install) {
        $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
@@ -53,6 +54,10 @@ if(!$install) {
        load_config('config');
        load_config('system');
 
+       $processlist = dbm::processlist();
+       if ($processlist != "")
+               logger("Processlist: ".$processlist, LOGGER_DEBUG);
+
        $maxsysload_frontend = intval(get_config('system','maxloadavg_frontend'));
        if($maxsysload_frontend < 1)
                $maxsysload_frontend = 50;