Пример #1
0
 public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null)
 {
     if ($source == null) {
         $source =& $this->driver_options;
     }
     switch ($attribute) {
         case EhrlichAndreas_Pdo_Abstract::ATTR_AUTOCOMMIT:
             $result = mysql_unbuffered_query('SELECT @@AUTOCOMMIT', $this->link);
             if (!$result) {
                 $this->set_driver_error(null, EhrlichAndreas_Pdo_Abstract::ERRMODE_EXCEPTION, $func);
             }
             $row = mysql_fetch_row($result);
             mysql_free_result($result);
             return intval($row[0]);
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_TIMEOUT:
             return intval(ini_get('mysql.connect_timeout'));
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_CLIENT_VERSION:
             return mysql_get_client_info();
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_CONNECTION_STATUS:
             return mysql_get_host_info($this->link);
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_INFO:
             return mysql_stat($this->link);
             break;
         case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_VERSION:
             return mysql_get_server_info($this->link);
             break;
         default:
             return parent::getAttribute($attribute, $source, $func, $last_error);
             break;
     }
 }
Пример #2
0
 public function estado_enlace()
 {
     $stat = explode('  ', mysql_stat($this->link));
     foreach ($stat as $campo => $valor) {
         echo '<b>' . $campo . '</b> ' . $valor . '<br />';
     }
 }
Пример #3
0
 function chk_db_connect($post)
 {
     if ($post['dbtype'] == 'mysql') {
         $conn = @mysql_connect($post['host'], $post['user'], $post['pass']);
         return @mysql_stat($conn);
     } elseif ($post['dbtype'] == 'postgresql') {
         $conn = pg_connect("host=" . $post['host'] . " port=5432 dbname=template1 user="******" password=" . $post['pass']);
         return $conn;
     }
 }
Пример #4
0
 public static function getDBStatus()
 {
     Piwik::checkUserIsSuperUser();
     $configDb = Zend_Registry::get('config')->database->toArray();
     // we decode the password. Password is html encoded because it's enclosed between " double quotes
     $configDb['password'] = htmlspecialchars_decode($configDb['password']);
     if (!isset($configDb['port'])) {
         // before 0.2.4 there is no port specified in config file
         $configDb['port'] = '3306';
     }
     $link = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
     $status = mysql_stat($link);
     mysql_close($link);
     return $status;
 }
Пример #5
0
 /**
  * Gets general database info that is not specific to any table.
  * 
  * @return array See http://dev.mysql.com/doc/refman/5.1/en/show-status.html .
  */
 public function getDBStatus()
 {
     if (function_exists('mysql_connect')) {
         $configDb = Piwik_Config::getInstance()->database;
         $link = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
         $status = mysql_stat($link);
         mysql_close($link);
         $status = explode("  ", $status);
     } else {
         $fullStatus = Piwik_FetchAssoc('SHOW STATUS');
         if (empty($fullStatus)) {
             throw new Exception('Error, SHOW STATUS failed');
         }
         $status = array('Uptime' => $fullStatus['Uptime']['Value'], 'Threads' => $fullStatus['Threads_running']['Value'], 'Questions' => $fullStatus['Questions']['Value'], 'Slow queries' => $fullStatus['Slow_queries']['Value'], 'Flush tables' => $fullStatus['Flush_commands']['Value'], 'Open tables' => $fullStatus['Open_tables']['Value'], 'Opens' => 'unavailable', 'Queries per second avg' => 'unavailable');
     }
     return $status;
 }
Пример #6
0
 /**
  * Connects to the database specified in the options.
  * If autoconnect is enabled (which is is by default),
  * this function will be called upon class instantiation.
  */
 public function connect()
 {
     if (!$this->conn) {
         // don't open a new connection if one already exists
         $this->conn = @mysql_connect($this->host, $this->user, $this->password);
         if (!$this->conn) {
             throw new OsimoException(OSIMODB_CONNECT_FAIL, "Could not connect to database at {$this->host}");
         }
         $this->conn_db = @mysql_select_db($this->name);
         if (!$this->conn_db) {
             throw new OsimoException(OSIMODB_SELECT_FAIL, "Could not select the database: {$this->name}");
         }
         get('debug')->logMsg('OsimoDB', 'events', 'Opening database connection...');
         $status = explode('  ', mysql_stat());
         get('debug')->logMsg('OsimoDB', 'events', "Current database status:\n" . print_r($status, true));
     }
 }
Пример #7
0
 	public function getDBStatus()
	{
		Piwik::checkUserIsSuperUser();

		if(function_exists('mysql_connect'))
		{
			$configDb = Zend_Registry::get('config')->database->toArray();
			// we decode the password. Password is html encoded because it's enclosed between " double quotes
			$configDb['password'] = htmlspecialchars_decode($configDb['password']);
			if(!isset($configDb['port']))
			{
				// before 0.2.4 there is no port specified in config file
				$configDb['port'] = '3306';  
			}

			$link   = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
			$status = mysql_stat($link);
			mysql_close($link);
			$status = explode("  ", $status);
		}
		else
		{
			$db = Zend_Registry::get('db');

			$fullStatus = $db->fetchAssoc('SHOW STATUS;');
			if(empty($fullStatus)) {
				throw new Exception('Error, SHOW STATUS failed');
			}

			$status = array(
				'Uptime' => $fullStatus['Uptime']['Value'],
				'Threads' => $fullStatus['Threads_running']['Value'],
				'Questions' => $fullStatus['Questions']['Value'],
				'Slow queries' => $fullStatus['Slow_queries']['Value'],
				'Flush tables' => $fullStatus['Flush_commands']['Value'],
				'Open tables' => $fullStatus['Open_tables']['Value'],
//				'Opens: ', // not available via SHOW STATUS
//				'Queries per second avg' =/ // not available via SHOW STATUS
			);
		}

		return $status;
	}
Пример #8
0
 /**
  * Show general table stats
  *
  * @access	public
  */
 public function index()
 {
     // -------------------------------------
     // Get basic info
     // -------------------------------------
     $raw_stats = explode('  ', mysql_stat());
     $data = array();
     $data['stats'] = array();
     foreach ($raw_stats as $stat) {
         $break = explode(':', $stat);
         $data['stats'][trim($break[0])] = trim($break[1]);
     }
     // -------------------------------------
     // Get Processes
     // -------------------------------------
     $this->load->helper('number');
     $data['processes'] = $this->db->query('SHOW PROCESSLIST')->result();
     // -------------------------------------
     $this->template->build('admin/overview', $data);
 }
 public function __construct(Credentials $credentials, $workspace, $config)
 {
     $link = @mysql_connect($config->server, $credentials->getUserID(), $credentials->getPassword(), 1);
     if (mysql_stat($link) !== null) {
         if (!mysql_select_db($workspace, $link)) {
             $sql = "CREATE DATABASE {$workspace}";
             if (mysql_query($sql, $link)) {
                 mysql_select_db($workspace, $link);
                 $sql = "CREATE TABLE c (p text NOT NULL,\n\t\t\t\t\t\t\t\tn text NOT NULL,\n\t\t\t\t\t\t\t\tv text NOT NULL,\n\t\t\t\t\t\t\t\tKEY INDEX1 (p (1000)),\n\t\t\t\t\t\t\t\tKEY INDEX2 (p (850), n (150)),\n\t\t\t\t\t\t\t\tKEY INDEX3 (p (550), n (150), v (300)),\n\t\t\t\t\t\t\t\tKEY INDEX4 (v (1000)))\n\t\t\t\t\t\t\t\tENGINE = MyISAM DEFAULT CHARSET = latin1";
                 mysql_query($sql, $link);
             } else {
                 throw new RepositoryException("in MySQL, cannot create workspace: {$workspace}");
             }
         }
         $this->credentials = $credentials;
         $this->workspace = $workspace;
         $this->config = $config;
         $this->link = $link;
         $this->isLive = true;
     }
 }
Пример #10
0
 function stat()
 {
     /* 取得当前系统状态 */
     return mysql_stat($this->LinkId);
 }
Пример #11
0
    public function cacheTestConnection()
    {
        $status = '';

        if ($this->cacheDbType != '' && $this->cacheDbh != false) {
            if (strtolower($this->cacheDbType) == 'mysql') {
                $status = mysql_stat($this->cacheDbh);
                if ($status && $status != '') {
                    $this->cachingOn = true;
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
Пример #12
0
if (is_object($database->DbHandle)) {
    $title = "MySQLi Info";
    $server_info = mysqli_get_server_info($database->DbHandle);
    $host_info = mysqli_get_host_info($database->DbHandle);
    $proto_info = mysqli_get_proto_info($database->DbHandle);
    $client_info = mysqli_get_client_info($database->DbHandle);
    $client_encoding = mysqli_character_set_name($database->DbHandle);
    $status = explode('  ', mysqli_stat($database->DbHandle));
} else {
    $title = "MySQL Info";
    $server_info = mysql_get_server_info();
    $host_info = mysql_get_host_info();
    $proto_info = mysql_get_proto_info();
    $client_info = mysql_get_client_info();
    $client_encoding = mysql_client_encoding();
    $status = explode('  ', mysql_stat());
}
$strictMode = $database->get_one('SELECT @@sql_mode');
$strict_info = (strpos($strictMode, 'STRICT_TRANS_TABLES') !== false or strpos($strictMode, 'STRICT_ALL_TABLES') !== false) ? "MySQL strict mode active" : "MySQL strict mode not active\n";
?>
<table cellpadding="3" border="0">
	<tbody>
	<tr class="h">
		<td><h1 class="p"><?php 
echo $title;
?>
</h1></td>
	</tr>
	</tbody>
</table>
<br/>
Пример #13
0
        sql_query("UPDATE `profiler` SET `prfCount` = `prfCount` + 1, " . "`prfTime` = `prfTime` + '" . $generationTime . "' " . "WHERE `prfPage` = '" . addslashes($page) . "'");
    } else {
        sql_values(array("prfPage" => $page, "prfCount" => 1, "prfTime" => $generationTime));
        sql_insert("profiler");
    }
}
// Show "Page generated in N seconds" if the user is at least
// a moderator.
if (atLeastSModerator() || $_auth["useid"] == 34814) {
    include_once "serverload.php";
    $time_start = $_stats["startTime"];
    $time_end = gettimeofday();
    $secdiff = $time_end["sec"] - $time_start["sec"];
    $usecdiff = $time_end["usec"] - $time_start["usec"];
    $generationTime = round(($secdiff * 1000000 + $usecdiff) / 1000000, 3);
    $mysqlStat = mysql_stat();
    $queriesPerSecond = round(preg_replace('/.*' . preg_quote("Queries per second avg: ") . '([0-9\\.]+).*/', "\\1", $mysqlStat), 2);
    //if( isset( $_stats[ "startQueries" ]))
    //{
    //	$queryCount = preg_replace( '/.*'.preg_quote( "Questions: " ).
    //		'([0-9]+).*/', "\\1", $mysqlStat ) - $_stats[ "startQueries" ];
    //}
    //else
    //{
    //	$queryCount = 0;
    //}
    $mysqlUptime = round(preg_replace('/.*' . preg_quote("Uptime: ") . '([0-9\\.]+).*/', "\\1", $mysqlStat), 2);
    $upDays = floor($mysqlUptime / 60 / 60 / 24);
    $upHours = floor($mysqlUptime / 60 / 60) % 24;
    $upMinutes = $mysqlUptime / 60 % 60;
    echo " <br /> " . sprintf(_PAGE_GENERATED, $generationTime) . ", MySQL: " . $queriesPerSecond . " queries/sec, " . "uptime " . $upDays . "d " . $upHours . "h " . $upMinutes . "m. &middot; Server load: {$loadavg}";
Пример #14
0
 /**
  * Get details about the current system status
  * @return array details
  */
 public function status()
 {
     return explode('  ', mysql_stat($this->link_id));
 }
Пример #15
0
 /**
  * Return a few database statistics in an array.
  *
  * @return array Returns an array of statistics values on success or FALSE on error.
  */
 public function GetStatistics()
 {
     $this->ResetError();
     if (!$this->IsConnected()) {
         return $this->SetError('No connection', -1);
     } else {
         $result = mysql_stat($this->mysql_link);
         if (empty($result)) {
             $this->SetError('Failed to obtain database statistics', -1);
             // do NOT return to caller yet!
             return array('Query Count' => $this->query_count);
         }
         $tot_count = preg_match_all('/([a-z ]+):\\s*([0-9.]+)/i', $result, $matches);
         $info = array('Query Count' => $this->query_count);
         for ($i = 0; $i < $tot_count; $i++) {
             $info[$matches[1][$i]] = $matches[2][$i];
         }
         return $info;
     }
 }
 /**
  * Checks if current mysql connection is alive
  * @return bool Returns TRUE if connection is alive, else returns FALSE
  */
 public function isConnected()
 {
     return isset($this->dbLink) && $this->dbLink !== NULL && mysql_stat($this->dbLink) !== NULL;
 }
Пример #17
0
  $your_version.="<tr><td align=\"right\">Current version:</td><td align=\"left\">".implode(" ",$last_version)."</td></tr>\n";
  $your_version.="<tr><td colspan=\"2\" align=\"center\">Get Last Version <a href=\"http://www.btiteam.org\" target=\"_blank\">here</a>!</td></tr>\n</table>";
}
else
  {
  $your_version.="You have the latest xBtit version installed.($tracker_version Rev.$tracker_revision)";
}
if (!empty($your_version))
   $admin["xbtit_version"]=$your_version."<br />\n";
*/
$admin["infos"] .= "<br />\n<table border=\"0\">\n";
$admin["infos"] .= "<tr><td class=\"header\" align=\"center\">Server's OS</td></tr><tr><td align=\"left\">" . php_uname() . "</td></tr>";
$admin["infos"] .= "<tr><td class=\"header\" align=\"center\">PHP version</td></tr><tr><td align=\"left\">" . phpversion() . "</td></tr>";
$sqlver = mysql_fetch_row(do_sqlquery("SELECT VERSION()"));
$admin["infos"] .= "\n<tr><td class=\"header\" align=\"center\">MYSQL version</td></tr><tr><td align=\"left\">{$sqlver['0']}</td></tr>";
$sqlver = mysql_stat();
$sqlver = explode('  ', $sqlver);
$admin["infos"] .= "\n<tr><td valign=\"top\" class=\"header\" align=\"center\">MYSQL stats</td></tr>\n";
for ($i = 0; $i < count($sqlver); $i++) {
    $admin["infos"] .= "<tr><td align=\"left\">{$sqlver[$i]}</td></tr>\n";
}
$admin["infos"] .= "\n</table><br />\n";
unset($sqlver);
// check for news on btiteam site (read rss from comunication forum)
/*
if($btit_url_rss!="")
{
    include("$THIS_BASEPATH/include/class.rssreader.php");

    $btit_news=get_cached_version($btit_url_rss);
Пример #18
0
$row = $mysqldb->fetchObject();
$approvedcomments = $row->commenty;
$mysqldb->query("SELECT COUNT(*) as commentn FROM articles WHERE Approved = 'N' AND ParentID>0");
$row = $mysqldb->fetchObject();
$pendingcomments = $row->commentn;
$mysqldb->query("SELECT count(*) as qy from articles WHERE Approved = 'Q'");
$row = $mysqldb->fetchObject();
$pendingquestions = $row->qy;
$mysqldb->query("SELECT count(*) as qn from articles WHERE Approved = 'A'");
$row = $mysqldb->fetchObject();
$respondedquestions = $row->qn;
$totalarticles = $pendingarticles + $approvedarticles;
$totalcomments = $approvedcomments + $pendingcomments;
$totalquestions = $respondedquestions + $pendingquestions;
// if all is good, we've got our count variables
$mysqlstat = explode('  ', mysql_stat());
$rwxcheck = permcheck();
head_page($page_title);
menu_options($title, $vnum, $viewop, $pid, $keys, $adfl);
contentinit($title);
echo <<<_EOF
<font color="red">{$rwxcheck}</font>
<br />
<table>
<tr>
<td><a href="pending.php?acq=a">Pending Articles</a></td><td><a href="a_pendinga.php">{$pendingarticles}</a></td>
</tr>
<tr>
<td>Approved Articles</td><td>{$approvedarticles}</td>
</tr>
<tr>
Пример #19
0
 /**
  * get server status.
  * get a status string from the mysql server.
  *
  * - uptime
  * - threads
  * - questions handled
  * - # slow queries
  * - open connections
  * - # flush tables
  * - # open tables
  * - # queries / second
  *
  * @access public
  * @return string
  */
 public function getStatus()
 {
     if ($this->connect()) {
         return mysql_stat($this->_connection);
     }
     return null;
 }
Пример #20
0
<?php

include_once "connect.inc";
$dbname = 'test';
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysql_stat($link))) {
    printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
require 'table.inc';
if (!is_null($tmp = @mysql_stat($link, "foo"))) {
    printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
if (!is_string($stat = mysql_stat($link)) || '' === $stat) {
    printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n", gettype($stat), $stat, mysql_errno($link), mysql_error($link));
}
if (version_compare(PHP_VERSION, '5.9.9', '>') == 1 && !is_unicode($stat)) {
    printf("[004] Expecting Unicode error message!\n");
    var_inspect($stat);
}
if (!is_string($stat_def = mysql_stat()) || '' === $stat_def) {
    printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n", gettype($stat_def), $stat_def, mysql_errno(), mysql_error());
}
assert(soundex($stat) === soundex($stat_def));
mysql_close($link);
if (false !== ($tmp = mysql_stat($link))) {
    printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
}
print "done!";
Пример #21
0
 case 'mysqlinfo':
     echo window_title($database_window_title . "MySQL - Info");
     echo "<div class='row'><div class='row'><label class='etiquette'>" . $msg[sql_info_notices] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from notices") . "</div>";
     echo "<div class='row'><label class='etiquette'>" . $msg[sql_info_exemplaires] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from exemplaires") . "</div>";
     echo "<div class='row'><label class='etiquette'>" . $msg[sql_info_bulletins] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from bulletins") . "</div>";
     echo "<div class='row'><label class='etiquette'>" . $msg[sql_info_authors] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from authors") . "</div>";
     echo "<div class='row'><label class='etiquette'>" . $msg[sql_info_publishers] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from publishers") . "</div>";
     echo "<div class='row'><label class='etiquette'>" . $msg[sql_info_empr] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from empr") . "</div>";
     echo "<div class='row'><label class='etiquette'>" . $msg[sql_info_pret] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from pret") . "</div>";
     echo "<div class='row'><label class='etiquette'>" . $msg[sql_info_pret_archive] . "</label></div>\n\t\t\t  <div class='row'>" . pmb_sql_value("select count(*) as nb from pret_archive") . "</div>";
     echo "<hr />";
     echo "<div class='row'>\n\t\t\t\t<label class='etiquette' >MySQL Database name, host and user</label>\n\t\t\t\t</div>\n\t\t\t  <div class='row'>\n\t\t\t\t\t" . DATA_BASE . " on " . SQL_SERVER . ", user="******"\n\t\t\t\t\t</div>\n\t\t\t  <div class='row'>\n\t\t\t\t<label class='etiquette' >MySQL Server Information</label>\n\t\t\t\t</div>\n\t\t\t  <div class='row'>\n\t\t\t\t\t" . mysql_get_server_info() . "\n\t\t\t\t\t</div><hr />";
     echo "<div class='row'>\n\t\t\t\t<label class='etiquette' >MySQL Client Information</label>\n\t\t\t\t</div>\n\t\t\t  <div class='row'>\n\t\t\t\t\t" . mysql_get_client_info() . "\n\t\t\t\t\t</div><hr />";
     echo "<div class='row'>\n\t\t\t\t<label class='etiquette' >MySQL Host Information</label>\n\t\t\t\t</div>\n\t\t\t  <div class='row'>\n\t\t\t\t\t" . mysql_get_host_info() . "\n\t\t\t\t\t</div><hr />";
     echo "<div class='row'>\n\t\t\t\t<label class='etiquette' >MySQL Protocol Information</label>\n\t\t\t\t</div>\n\t\t\t  <div class='row'>\n\t\t\t\t\t" . mysql_get_proto_info() . "\n\t\t\t\t\t</div><hr />";
     echo "<div class='row'>\n\t\t\t\t<label class='etiquette' >MySQL Stat. Information</label>\n\t\t\t\t</div>\n\t\t\t  <div class='row'>\n\t\t\t\t\t" . str_replace('  ', '<br />', mysql_stat()) . "</div><hr />";
     echo "<div class='row'>\n\t\t\t\t<label class='etiquette' >MySQL Variables</label>\n\t\t\t\t</div>\n\t\t\t  <div class='row'><table>";
     $result = mysql_query('SHOW VARIABLES', $dbh);
     $parity = 0;
     while ($row = mysql_fetch_assoc($result)) {
         if ($parity % 2) {
             $pair_impair = "even";
         } else {
             $pair_impair = "odd";
         }
         $parity += 1;
         echo "<tr class='{$pair_impair}'><td>" . $row['Variable_name'] . "</td><td>" . $row['Value'] . "</td></tr>";
     }
     echo "</table></div>";
     break;
 case '':
Пример #22
0
 function mysql_stat()
 {
     return mysql_stat($this->link);
 }
Пример #23
0
 public function GetStat()
 {
     if ($this->DB_conn == NULL) {
         return "";
     }
     $result = array("MySQL server version" => mysql_get_server_info($this->DB_conn), "MySQL protocol version" => mysql_get_proto_info($this->DB_conn), "MySQL host info" => mysql_get_host_info($this->DB_conn), "MySQL client info" => mysql_get_client_info($this->DB_conn), "More info" => str_replace("  ", "\n", mysql_stat($this->DB_conn)), "Process list" => implode("\n", $this->GetProcesses()));
     return $result;
 }
Пример #24
0
	function DisplayStatus() {
	
		$urllist['System Status'] = "status.php";
		NavigationBar("System", $urllist);

		# connect to DB and get status
		$dbconnect = true;
		$devdbconnect = true;
		$L = mysqli_connect($GLOBALS['cfg']['mysqlhost'],$GLOBALS['cfg']['mysqluser'],$GLOBALS['cfg']['mysqlpassword'],$GLOBALS['cfg']['mysqldatabase']) or $dbconnect = false;
		$dbStatus = explode("  ", mysql_stat());
		
		# get number of fileio operations pending
		$sqlstring = "select count(*) 'numiopending' from fileio_requests where request_status in ('pending','')";
		$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numiopending = $row['numiopending'];
		
		# get number of directories in dicomincoming directory
		$dirs = glob($GLOBALS['cfg']['incomingdir'].'/*', GLOB_ONLYDIR);
		$numdicomdirs = count($dirs);
		
		# get number of files in dicomincoming directory
		$files = glob($GLOBALS['cfg']['incomingdir'].'/*');
		$numdicomfiles = count($files);
		
		# get number of import requests
		$sqlstring = "select count(*) 'numimportpending' from import_requests where import_status in ('pending','')";
		$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
		$row = mysql_fetch_array($result, MYSQL_ASSOC);
		$numimportpending = $row['numimportpending'];
		
		# get number of directories in dicomincoming directory
		$dirs = glob($GLOBALS['cfg']['uploadedpath'].'/*', GLOB_ONLYDIR);
		$numimportdirs = count($dirs);
		
		?>
		<table class="entrytable">
			<tr>
				<td class="label">Uptime</td>
				<td><pre><?php 
echo trim(`uptime`);
?>
</pre></td>
			</tr>
			<tr>
				<td class="label">Memory (GB)</td>
				<td><pre><?php 
echo trim(`free -g`);
?>
</pre></td>
			</tr>
			<tr>
				<td class="label">Disk usage</td>
				<td><pre><?php 
echo system('df -lh');
?>
</pre></td>
			</tr>
			<tr>
				<td class="label">Database</td>
				<td><pre><?
				foreach ($dbStatus as $value){
echo $value . "\n";
				}
				?></pre></td>
			</tr>
			<tr>
				<td class="label">Parse DICOM module<br><span class="tiny"><?php 
echo $GLOBALS['cfg']['incomingdir'];
?>
</span></td>
				<td>
					<?php 
echo $numdicomfiles;
?>
 queued files<br>
					<?php 
echo $numdicomdirs;
?>
 queued directories<br>
				</td>
			</tr>
			<tr>
				<td class="label">Import module<br><span class="tiny"><?php 
echo $GLOBALS['cfg']['uploadedpath'];
?>
</span></td>
				<td>
					<?php 
echo $numimportpending;
?>
 requests pending<br>
					<?php 
echo $numimportdirs;
?>
 queued directories<br>
				</td>
			</tr>
			<tr>
				<td class="label">File IO module</td>
				<td><?php 
echo $numiopending;
?>
 operations pending</td>
			</tr>
			<tr>
				<td class="label">Pipeline module</td>
				<td>
					<table class="smallgraydisplaytable">
					<thead>
						<tr>
							<th>Process ID</th>
							<th>Status</th>
							<th>Startdate</th>
							<th>Last checkin</th>
							<th>Current pipeline</th>
							<th>Current study</th>
						</tr>
					</thead>
					<tbody>
					<?
						$sqlstring = "select a.*, b.pipeline_name from pipeline_procs a left join pipelines b on a.pp_currentpipeline = b.pipeline_id order by a.pp_lastcheckin";
						$result = MySQLQuery($sqlstring,__FILE__,__LINE__);
						while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
							$pp_processid = $row['pp_processid'];
							$pp_status = $row['pp_status'];
							$pp_startdate = $row['pp_startdate'];
							$pp_lastcheckin = $row['pp_lastcheckin'];
							$pp_currentpipeline = $row['pp_currentpipeline'];
							$pipelinename = $row['pipeline_name'];
							$pp_currentsubject = $row['pp_currentsubject'];
							$pp_currentstudy = $row['pp_currentstudy'];
							?>
							<tr>
								<td><?php 
echo $pp_processid;
?>
</td>
								<td><?php 
echo $pp_status;
?>
</td>
								<td><?php 
echo $pp_startdate;
?>
</td>
								<td><?php 
echo $pp_lastcheckin;
?>
</td>
								<td><?php 
echo $pipelinename;
?>
</td>
								<td><?php 
echo $pp_currentstudy;
?>
</td>
							</tr>
							<?
						}
					?>
					</tbody>
					</table>
				</td>
			</tr>
		</table>
		<?
	}
Пример #25
0
 /**
  * Test mysql_stat
  *
  * @return boolean
  */
 public function MySQL_Stat_Test()
 {
     // Get stats
     $stat1 = mysql_stat();
     $finds = array('Uptime:', 'Threads:', 'Questions:', 'Open tables:', 'Queries per second');
     foreach ($finds as $find) {
         if (stripos($stat1, $find) === false) {
             return false;
         }
     }
     // Compare
     return true;
 }
Пример #26
0
 public static function stat($stat = null)
 {
     if ($stat === null) {
         return mysql_stat();
     } else {
         return mysql_stat($stat);
     }
 }
Пример #27
0
 /**
  * Test mysql_stat
  *
  * @return boolean
  */
 public function MySQL_Stat_Test()
 {
     // Get stats
     $stat1 = mysql_stat();
     $stat2 = $this->_object->mysql_stat();
     // Extract all #'s out
     preg_match_all('!\\d+!', $stat1, $matches1);
     preg_match_all('!\\d+!', $stat2, $matches2);
     unset($stat1, $stat2);
     // Go through each number
     $count = count($matches1[0]);
     for ($x = 0; $x < $count; $x++) {
         $diff = abs($matches1[0][$x] - $matches2[0][$x]);
         // Make sure that the difference is <= 10 (margin of change while queries are running)
         if ($diff > 10) {
             return false;
         }
     }
     return true;
 }
Пример #28
0
 function stat()
 {
     if (!$this->curlink) {
         $this->connect();
     }
     return mysql_stat($this->curlink);
 }
Пример #29
0
function DB_GetMysqlStats()
{
    // --- Abort in this case!
    if (GetConfigSetting("UserDBEnabled", false) == false) {
        return;
    }
    // ---
    global $userdbconn;
    $status = explode('  ', mysql_stat($userdbconn));
    return $status;
}
Пример #30
0
            }
        }
    }
}
/* validate page request */
// empty defaults to landing page set in config
if (empty($_REQUEST['page'])) {
    $loadPage = $cfg['landing_page'];
} elseif (in_array($_REQUEST['page'], $pagesArray)) {
    $loadPage = $_REQUEST['page'];
} else {
    die('page: ' . $_REQUEST['page'] . ', does not exist');
}
// else $loadPage='404error';
/* output page */
$template->load(PATH . './pages/' . $loadPage . '.php');
$templateList = loadTemplates();
foreach ($templateList as $tpl) {
    $tplName = substr($tpl, 0, strlen($tpl) - 4);
    $template->replace($tplName, file_get_contents(PATH . $cfg['theme_templateDir'] . $tpl));
}
$template->publish();
/* debug stats */
@(print '<p>' . mysql_stat($cfg['mysql_linkid']) . '</p>');
$microTime = microtime();
$microTime = explode(' ', $microTime);
$microTime = $microTime[1] + $microTime[0];
$loadEnd = $microTime;
$loadTime = round($loadEnd - $loadStart, 4);
echo '<p>Page generated in ' . $loadTime . ' seconds.' . '</p>';
exit;