]> git.mxchange.org Git - friendica.git/blobdiff - include/dbm.php
Merge pull request #2744 from tobiasd/20160820-cal
[friendica.git] / include / dbm.php
index d588b2f76a31946c5952de0aec817210b1e02569..fdd9f40e762a1b1443de691390f3cca572703634 100644 (file)
@@ -1,5 +1,16 @@
 <?php
+/**
+ * @brief This class contain functions for the database management
+ *
+ */
 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() {
                $r = q("SHOW PROCESSLIST");
                $s = array();
@@ -8,14 +19,13 @@ class dbm {
                $states = array();
                foreach ($r AS $process) {
                        $state = trim($process["State"]);
+
+                       // Filter out all idle processes
                        if (!in_array($state, array("", "init", "statistics"))) {
                                ++$states[$state];
                                ++$processes;
                        }
                }
-               // query end
-               // Sending data
-               // updating
 
                $statelist = "";
                foreach ($states AS $state => $usage) {
@@ -25,5 +35,15 @@ class dbm {
                }
                return(array("list" => $statelist, "amount" => $processes));
        }
+
+       /**
+        * Checks if $array is a filled array with at least one entry.
+        *
+        * @param       $array  mixed   A filled array with at least one entry
+        * @return      Whether $array is a filled array
+        */
+       public static function is_result($array) {
+               return (is_array($array) && count($array) > 0);
+       }
 }
 ?>