Source for file systemstats.php

Documentation is available at systemstats.php

  1. <?php
  2. /**
  3. * Collate some stats on the current usage of the system (number of bookings etc)
  4. *
  5. @author     Stuart Prescott
  6. @copyright  Copyright Stuart Prescott
  7. @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  8. @version    $Id$
  9. @package    Bumblebee
  10. @subpackage Misc
  11. */
  12.  
  13. /** Load ancillary functions */
  14. require_once 'inc/typeinfo.php';
  15.  
  16. /**
  17. * Collate some stats on the current usage of the system (number of bookings etc)
  18. *
  19. @package    Bumblebee
  20. @subpackage Misc
  21. */
  22. class SystemStats {
  23.   /**
  24.   * numbers of rows in each table ($table => $num_rows)
  25.   * @var array 
  26.   */
  27.   var $stats;
  28.   /**
  29.   * tables on which stats should be compiled
  30.   * @var array 
  31.   */
  32.   var $tables;
  33.  
  34.   /**
  35.   * Constructor: load up the stats
  36.   */
  37.   function SystemStats({
  38.     $tables array('users''projects''instruments''bookings');
  39.     foreach ($tables as $t{
  40.       $this->stats[$t]       $this->countEntries($t);
  41.     }
  42.   }
  43.  
  44.   /**
  45.   * Runs the SQL count(*) query to find out how many rows in the table
  46.   * @param string $table the table to query
  47.   */
  48.   function countEntries($table{
  49.     $row quickSQLSelect($table''''01);
  50.     return $row[0];
  51.   }
  52.  
  53.   /**
  54.   * Return the stats for the designated table
  55.   * @param string $table the table to query
  56.   */
  57.   function get($table{
  58.     return $this->stats[$table];
  59.   }
  60. }
  61.  
  62. /**
  63. @return string name of the server software
  64. */
  65. function webserver_get_name({
  66.   if (isset($_SERVER['SERVER_SOFTWARE'])) return "";
  67.   return substr($_SERVER['SERVER_SOFTWARE']0strpos($_SERVER['SERVER_SOFTWARE']'/'));
  68. }
  69.  
  70. /**
  71. @return string version of the server software
  72. */
  73. function webserver_get_version({
  74.   if (isset($_SERVER['SERVER_SOFTWARE'])) return "";
  75.   $slash   strpos($_SERVER['SERVER_SOFTWARE']'/');
  76.   $version substr($_SERVER['SERVER_SOFTWARE']$slash+1);
  77.   $space   strpos($version' ');
  78.   if ($space !== false$version substr($version0$space);
  79.   return $version;
  80. }
  81. ?>

Documentation generated on Tue, 06 Mar 2007 10:02:00 +0000 by phpDocumentor 1.3.0