[PC-BSD Commits] r2806 - in websites/bsdstats.org: . bsdstats/bin bsdstats/lib bsdstats/sbin/cache bsdstats/tpl/bsdstats
svn at pcbsd.org
svn at pcbsd.org
Sun Sep 21 15:00:52 PDT 2008
Author: fabry
Date: 2008-09-21 15:00:51 -0700 (Sun, 21 Sep 2008)
New Revision: 2806
Added:
websites/bsdstats.org/bsdstats/bin/mm.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/device_subclasses.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/release.php
Modified:
websites/bsdstats.org/bsdstats/bin/start.php
websites/bsdstats.org/bsdstats/lib/bsdstats.php
websites/bsdstats.org/bsdstats/sbin/cache/memcached.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/cpu.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/device.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/home.php
websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php
websites/bsdstats.org/ports.php
websites/bsdstats.org/releases.php
Log:
- fixed link for instructions on the home page
- added "releases"
- finished the "devices" section
- removed the CPU and Ports links from an OS specific menu (I cannot find the way to find the stats for each OS for those sections)
- added a way to track memcached stats for the current server: http://www.bsdstats.org/bm/mm
Modified: websites/bsdstats.org/bsdstats/bin/start.php
===================================================================
--- websites/bsdstats.org/bsdstats/bin/start.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/bsdstats/bin/start.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -21,6 +21,7 @@
$this->display->assign('home_uri',$this->uri->create_uri($url));
$this->display->assign('instructions_uri',$this->uri->create_uri(array_merge(array(TASK_KEY=>'instructions'),$url)));
+ $this->display->assign('releases_uri',$this->uri->create_uri(array_merge(array(TASK_KEY=>'releases'),$url)));
$this->display->assign('countries_uri',$this->uri->create_uri(array_merge(array(TASK_KEY=>'countries'),$url)));
$this->display->assign('cpus_uri',$this->uri->create_uri(array_merge(array(TASK_KEY=>'cpus'),$url)));
$this->display->assign('devices_uri',$this->uri->create_uri(array_merge(array(TASK_KEY=>'devices'),$url)));
@@ -77,14 +78,28 @@
}
public function web_devices(){
- $tmp = load_library('bsdstats')->devices($this->uri->get('class',''));
+ $tmp = load_library('bsdstats')->devices($this->uri->get('class',''),$this->uri->get('subclass',''));
$this->display->assign('devices_stats', $tmp['devices_stats']);
$this->display->assign('devices_class_stats', isset($tmp['devices_class_stats'])?$tmp['devices_class_stats']:array());
+ $this->display->assign('devices_class_subclass_stats', isset($tmp['devices_class_subclass_stats'])?$tmp['devices_class_subclass_stats']:array());
$this->display->assign('title', 'Devices Stats');
- $this->display('device');
+ if(isset($tmp['devices_class_subclass_stats'])){
+ $this->display('device_subclasses');
+ } else {
+ $this->display('device');
+ }
}
+ public function web_releases(){
+ $tmp = load_library('bsdstats')->releases();
+ $this->display->assign('releases_major_stats', $tmp['releases_major_stats']);
+ $this->display->assign('releases_stats', $tmp['releases_stats']);
+ $this->display->assign('title', 'Releases Stats');
+ $this->display('release');
+ }
+
+
}
?>
\ No newline at end of file
Modified: websites/bsdstats.org/bsdstats/lib/bsdstats.php
===================================================================
--- websites/bsdstats.org/bsdstats/lib/bsdstats.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/bsdstats/lib/bsdstats.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -109,7 +109,11 @@
return $return;
}
- public function devices($class=''){
+ public function devices($class='', $subclass=''){
+ $return1 = array();
+ $return2 = array();
+ $return3 = array();
+ //--
$return1 = load_class('cache')->get('devices'.$this->current_os);
if($return1==false){
$sql = 'SELECT d.class,
@@ -171,45 +175,102 @@
$return2 = array('devices_class_stats'=>$devices_class_stats);
load_class('cache')->set('devices_class'.$class.$this->current_os, $return2);
}
- } else {
- $return2 = array();
+ if($subclass!=''){
+ $return3 = load_class('cache')->get('devices_class_subclass'.$class.$subclass.$this->current_os);
+ if($return3==false){
+ $sql = 'SELECT
+ TRIM(driver, \'[0123456789]*\') AS driver,
+ dm_v.description AS vendor,
+ dm_d.description AS device,
+ count(1) AS cnt
+ FROM systems s
+ LEFT JOIN system_ids si ON s.id = si.id
+ LEFT JOIN devices d ON si.id = d.id
+ LEFT JOIN device_map dm_v ON (upper(d.device) = dm_v.device_id AND dm_v.vendor_id = \'NULL\')
+ LEFT JOIN device_map dm_d ON (upper(d.vendor) = dm_d.device_id AND upper(d.device) = dm_d.vendor_id )
+ WHERE DATE_TRUNC(\'month\', s.report_month) = date_trunc(\'month\', now())
+ AND DATE_TRUNC(\'month\', d.report_month) = date_trunc(\'month\', now())
+ AND d.class = \''.$this->db->escape_string($class).'\'
+ AND substring(d.subclass for 2) = \''.$this->db->escape_string($subclass).'\' ';
+ if($this->current_os!=''){
+ $sql .= 'AND os_id=( SELECT id FROM operating_systems WHERE operating_system = \''.$this->current_os.'\' )';
+ }
+ $sql .= 'GROUP BY TRIM(driver, \'[0123456789]*\'), dm_v.description, dm_d.description
+ ORDER BY TRIM(driver, \'[0123456789]*\'), dm_v.description, cnt DESC';
+
+ $tmps = $this->db->query($sql);
+ $devices_class_subclass_stats = array();
+ $i=0;
+ while($tmp = $this->db->fetch_array($tmps)){
+ $devices_class_subclass_stats[$i]['driver'] = $tmp['driver'];
+ $devices_class_subclass_stats[$i]['vendor'] = $tmp['vendor'];
+ $devices_class_subclass_stats[$i]['device'] = $tmp['device'];
+ $devices_class_subclass_stats[$i]['total'] = $tmp['cnt'];
+ $i++;
+ }
+ $return3 = array('devices_class_subclass_stats'=>$devices_class_subclass_stats);
+
+ load_class('cache')->set('devices_class_subclass'.$class.$subclass.$this->current_os, $return3);
+ }
+ }
}
- return array_merge($return1,$return2);
+ return array_merge($return1,$return2,$return3);
}
- public function drivers(){
- $return = load_class('cache')->get('drivers'.$this->current_os);
- if($return==false){
- $tmps = $this->db->query('SELECT trim(driver, \'[0123456789]*\') AS driver, count(1) AS cnt
- FROM devices d
- WHERE date_trunc(\'month\', report_month) = date_trunc(\'month\', now())
- GROUP BY trim(driver, \'[0123456789]*\')
- ORDER BY driver;');
- $drivers_tot = array();
+ public function releases(){
+ $return1 = load_class('cache')->get('releases_major'.$this->current_os);
+ if($return1==false){
+ $sql = 'SELECT architecture,
+ substring(release for 1) as release,
+ COUNT(1) as cnt
+ FROM systems
+ WHERE true ';
+ if($this->current_os!=''){
+ $sql .= 'AND os_id=( SELECT id FROM operating_systems WHERE operating_system = \''.$this->current_os.'\' )';
+ }
+ $sql .= 'GROUP BY architecture, substring(release for 1)
+ ORDER BY architecture, cnt DESC';
+
+ $tmps = $this->db->query($sql);
+ $releases_major_stats = array();
+ $i=0;
while($tmp = $this->db->fetch_array($tmps)){
- $drivers_tot[$tmp['driver']] = $tmp['cnt'];
+ $releases_major_stats[$i]['architecture'] = $tmp['architecture'];
+ $releases_major_stats[$i]['release'] = $tmp['release'];
+ $releases_major_stats[$i]['total'] = $tmp['cnt'];
+ $i++;
}
-
- $tmps = $this->db->query('SELECT TRIM(driver, \'[0123456789]*\') AS driver, dm_v.description AS vendor, dm_d.description AS device, count(1) AS cnt
- FROM devices d
- LEFT JOIN device_map dm_v ON ( upper(d.device) = dm_v.device_id AND dm_v.vendor_id = \'NULL\')
- LEFT JOIN device_map dm_d ON ( upper(d.vendor) = dm_d.device_id AND upper(d.device) = dm_d.vendor_id )
- WHERE date_trunc(\'month\', d.report_month) = date_trunc(\'month\', now())
- GROUP BY TRIM(driver, \'[0123456789]*\'), dm_v.description, dm_d.description
- ORDER BY driver, vendor, cnt DESC;');
- $drivers_stats = array();
+
+ $return1 = array('releases_major_stats'=>$releases_major_stats);
+ load_class('cache')->set('releases_major'.$this->current_os, $return1);
+ }
+ $return2 = load_class('cache')->get('releases'.$this->current_os);
+ if($return2==false){
+ $sql = 'SELECT architecture,
+ release,
+ COUNT(1) as cnt
+ FROM systems
+ WHERE true ';
+ if($this->current_os!=''){
+ $sql .= 'AND os_id=( SELECT id FROM operating_systems WHERE operating_system = \''.$this->current_os.'\' )';
+ }
+ $sql .= 'GROUP BY architecture, release
+ ORDER BY architecture, cnt DESC';
+
+ $tmps = $this->db->query($sql);
+ $releases_stats = array();
$i=0;
while($tmp = $this->db->fetch_array($tmps)){
- $drivers_stats[$i]['driver'] = $tmp['driver'];
- $drivers_stats[$i]['vendor'] = $tmp['vendor'];
- $drivers_stats[$i]['device'] = $tmp['device'];
- $drivers_stats[$i]['total'] = $tmp['cnt'];
+ $releases_stats[$i]['architecture'] = $tmp['architecture'];
+ $releases_stats[$i]['release'] = $tmp['release'];
+ $releases_stats[$i]['total'] = $tmp['cnt'];
$i++;
}
- $return = array('drivers_tot'=>$drivers_tot,'drivers_stats'=>$drivers_stats);
- load_class('cache')->set('drivers'.$this->current_os, $return);
+
+ $return2 = array('releases_stats'=>$releases_stats);
+ load_class('cache')->set('releases'.$this->current_os, $return2);
}
- return $return;
+ return array_merge($return1,$return2);
}
}
?>
\ No newline at end of file
Modified: websites/bsdstats.org/bsdstats/sbin/cache/memcached.php
===================================================================
--- websites/bsdstats.org/bsdstats/sbin/cache/memcached.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/bsdstats/sbin/cache/memcached.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -138,7 +138,7 @@
$con = $this->_getConForKey($key);
if ($con === false) return false;
$this->numSet++;
- $return = $con->set($key, $var, $compress?MEMCACHE_COMPRESSED:false,, $expire);
+ $return = $con->set($key, $var, $compress?MEMCACHE_COMPRESSED:false, $expire);
$time2=$this->getmicrotime();
$this->total_time += $time2-$time1;
return $return;
Modified: websites/bsdstats.org/bsdstats/tpl/bsdstats/cpu.php
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/bsdstats/cpu.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/bsdstats/tpl/bsdstats/cpu.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -1,5 +1,4 @@
-<!-- Countries -->
-<div id="country">
+<div id="cpu">
<h3>CPUs</h3>
<table cellspacing="0" cellpadding="0" class="stats-simple stats-small" style="float:left;">
<thead>
Modified: websites/bsdstats.org/bsdstats/tpl/bsdstats/device.php
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/bsdstats/device.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/bsdstats/tpl/bsdstats/device.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -10,13 +10,13 @@
</thead>
<tbody><?php
$old_driver = '';
-$i=0;
-$format = load_library('format');
-$uri = load_class('uri');
+$i = 0;
+$format = load_library('format');
+$uri = load_class('uri');
-$class = $uri->get('class','');
+$class = $uri->get('class','');
-$url = array();
+$url = array();
$url[TASK_KEY] = $task;
if($uri->get('os','')!=''){
$url['os'] = $uri->get('os','');
Modified: websites/bsdstats.org/bsdstats/tpl/bsdstats/home.php
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/bsdstats/home.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/bsdstats/tpl/bsdstats/home.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -52,7 +52,7 @@
default:
$os_info['name'] = 'BSD-Stats';
$os_info['url'] = '';
- $os_info['description'] = '<p>The mission of this site is to compile semi-accurate numbers for advocacy and marketing of the *BSD operating systems.</p><p>More specifically, we are trying to demonstrate to hardware and software vendors out there that *BSD should be viewed as a serious operating system, not just as a hobbyist system, for support (ie. hardware drivers) purposes.</p><p>We are designing the system so that FreeBSD, NetBSD, OpenBSD, PC-BSD and DragonFlyBSD can participate and benefit. <a href="<?php echo $instructions_uri?>">Click here for Instructions</a></p><p>If you have any questions, comments, or suggestions, please send email to <a href="mailto:scrappy at freebsd.org">scrappy at freebsd.org</a>.</p>Project hosted by <a href="http://www.hub.org">Hub.Org Networking Services</a><br/>Web Design by Antony Mawer<br />Web Programmed by Fabrizio Parrella</p>';
+ $os_info['description'] = '<p>The mission of this site is to compile semi-accurate numbers for advocacy and marketing of the *BSD operating systems.</p><p>More specifically, we are trying to demonstrate to hardware and software vendors out there that *BSD should be viewed as a serious operating system, not just as a hobbyist system, for support (ie. hardware drivers) purposes.</p><p>We are designing the system so that FreeBSD, NetBSD, OpenBSD, PC-BSD and DragonFlyBSD can participate and benefit. <a href="'.$instructions_uri.'">Click here for Instructions</a></p><p>If you have any questions, comments, or suggestions, please send email to <a href="mailto:scrappy at freebsd.org">scrappy at freebsd.org</a>.</p>Project hosted by <a href="http://www.hub.org">Hub.Org Networking Services</a><br/>Web Design by Antony Mawer<br />Web Programmed by Fabrizio Parrella</p>';
break;
}
?><!-- Our mission -->
Modified: websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php
===================================================================
--- websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/bsdstats/tpl/bsdstats/menu.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -12,15 +12,21 @@
<ul>
<?php
if($current_os!=''){
- ?><li class="first" id="toplink-os-name"><a href="<?php echo $home_uri?>"><?php echo $current_os?>:</a></li><?php
+ ?><li class="first" id="toplink-os-name"><?php echo $current_os?>:</a></li>
+ <li><a href="<?php echo $home_uri?>">Home</a></li><?php
} else {
?><li class="first"><a href="/">Home</a></li><?php
}
?>
- <li><a href="#">Release Stats</a></li>
+ <li><a href="<?php echo $releases_uri?>">Release Stats</a></li>
<li><a href="<?php echo $countries_uri?>">Country Stats</a></li>
<li><a href="<?php echo $devices_uri?>">Device Stats</a></li>
+<?php
+if($current_os==''){
+ ?>
<li><a href="<?php echo $cpus_uri?>">CPU Stats</a></li>
<li><a href="#">Ports Stats</a></li>
+ <?php
+} ?>
</ul>
</div>
Modified: websites/bsdstats.org/ports.php
===================================================================
--- websites/bsdstats.org/ports.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/ports.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -1,91 +1,91 @@
-<p>
-
-<table>
- <tr>
- <td valign="top">
-<?php
- $conn = pg_pconnect("host=bsdstats.org dbname=bsdstats_new user=pgsql");
-?>
-
- <td valign="top"
-<table border=1>
- <tr>
- <th><font size="-1">Category</th>
-<?php
- if(isset($_GET["category"])) {
-?>
- <th><font size="-1">Software</th>
-<?php
- if(isset($_GET["software"])) {
-?>
- <th><font size="-1">Version</th>
- <th><font size="-1">Times in Use</th>
-<?php
- } else {
-?>
- <th><font size="-1">Times in Use</th>
-<?php
- }
- }
-?>
- </tr>
-<?php
- $res = pg_query($conn, "SELECT DISTINCT CASE WHEN category = '' THEN 'none' ELSE category END AS category FROM ports ORDER BY category;");
-
- $category = $software = "";
- for($ii=0;$ii<pg_num_rows($res);$ii++) {
- $data = pg_fetch_object($res, $ii);
-?>
- <td nowrap><font size="-1"><a href="ports.php?category=<?php echo $data->category; ?>"><?php if($data->category != $category) { $category = $data->category; printf("%s", $data->category); } ?></a></td>
-<?php
- if(isset($_GET["category"]) && ( $_GET["category"] == $data->category) ) {
- $cat = pg_query($conn, "SELECT DISTINCT software, count(1) AS count FROM ports WHERE category = '" . $_GET["category"] . "' GROUP BY software ORDER BY software;");
- for($jj=0;$jj<pg_num_rows($cat);$jj++) {
- $softrec = pg_fetch_object($cat, $jj);
- if($jj > 0) {
-?>
- </tr>
- <tr>
- <td nowrap></td>
-<?php
- }
-?>
- <td nowrap><font size="-1"><a href="ports.php?category=<?php echo $data->category; ?>&software=<?php echo $softrec->software ?>"><?php if($softrec->software != $software) { $software = $softrec->software; printf("%s", $softrec->software); } ?></a></td>
-<?php
- if(isset($_GET["software"]) && ( $_GET["software"] == $softrec->software) ) {
- $ver = pg_query($conn, "SELECT DISTINCT version, count(1) AS count FROM ports WHERE category = '" . $_GET["category"] . "' AND software = '" . $_GET["software"] . "' GROUP BY version ORDER BY version;");
- for($kk=0;$kk<pg_num_rows($ver);$kk++) {
- $verrec = pg_fetch_object($ver, $kk);
- if($kk > 0) {
-?>
- </tr>
- <tr>
- <td nowrap></td>
- <td nowrap></td>
-<?php
- }
-?>
- <td nowrap align="right"><font size="-1"><?php printf("%s", $verrec->version); ?></a></td>
- <td nowrap align="right"><font size="-1"><?php echo $verrec->count; ?></a></td>
-<?php
- }
- } else {
-?>
- <td nowrap align="right"><font size="-1"><?php echo $softrec->count; ?></a></td>
-<?php
- }
- }
- } else {
-?>
- </tr>
-<?php
- }
-?>
- </tr>
-<?php
- }
-?>
-</table>
- </td>
- </tr>
-</table>
+<p>
+
+<table>
+ <tr>
+ <td valign="top">
+<?php
+ $conn = pg_pconnect("host=bsdstats.org dbname=bsdstats_new user=pgsql");
+?>
+
+ <td valign="top"
+<table border=1>
+ <tr>
+ <th><font size="-1">Category</th>
+<?php
+ if(isset($_GET["category"])) {
+?>
+ <th><font size="-1">Software</th>
+<?php
+ if(isset($_GET["software"])) {
+?>
+ <th><font size="-1">Version</th>
+ <th><font size="-1">Times in Use</th>
+<?php
+ } else {
+?>
+ <th><font size="-1">Times in Use</th>
+<?php
+ }
+ }
+?>
+ </tr>
+<?php
+ $res = pg_query($conn, "SELECT DISTINCT CASE WHEN category = '' THEN 'none' ELSE category END AS category FROM ports ORDER BY category;");
+
+ $category = $software = "";
+ for($ii=0;$ii<pg_num_rows($res);$ii++) {
+ $data = pg_fetch_object($res, $ii);
+?>
+ <td nowrap><font size="-1"><a href="ports.php?category=<?php echo $data->category; ?>"><?php if($data->category != $category) { $category = $data->category; printf("%s", $data->category); } ?></a></td>
+<?php
+ if(isset($_GET["category"]) && ( $_GET["category"] == $data->category) ) {
+ $cat = pg_query($conn, "SELECT DISTINCT software, count(1) AS count FROM ports WHERE category = '" . $_GET["category"] . "' GROUP BY software ORDER BY software;");
+ for($jj=0;$jj<pg_num_rows($cat);$jj++) {
+ $softrec = pg_fetch_object($cat, $jj);
+ if($jj > 0) {
+?>
+ </tr>
+ <tr>
+ <td nowrap></td>
+<?php
+ }
+?>
+ <td nowrap><font size="-1"><a href="ports.php?category=<?php echo $data->category; ?>&software=<?php echo $softrec->software ?>"><?php if($softrec->software != $software) { $software = $softrec->software; printf("%s", $softrec->software); } ?></a></td>
+<?php
+ if(isset($_GET["software"]) && ( $_GET["software"] == $softrec->software) ) {
+ $ver = pg_query($conn, "SELECT DISTINCT version, count(1) AS count FROM ports WHERE category = '" . $_GET["category"] . "' AND software = '" . $_GET["software"] . "' GROUP BY version ORDER BY version;");
+ for($kk=0;$kk<pg_num_rows($ver);$kk++) {
+ $verrec = pg_fetch_object($ver, $kk);
+ if($kk > 0) {
+?>
+ </tr>
+ <tr>
+ <td nowrap></td>
+ <td nowrap></td>
+<?php
+ }
+?>
+ <td nowrap align="right"><font size="-1"><?php printf("%s", $verrec->version); ?></a></td>
+ <td nowrap align="right"><font size="-1"><?php echo $verrec->count; ?></a></td>
+<?php
+ }
+ } else {
+?>
+ <td nowrap align="right"><font size="-1"><?php echo $softrec->count; ?></a></td>
+<?php
+ }
+ }
+ } else {
+?>
+ </tr>
+<?php
+ }
+?>
+ </tr>
+<?php
+ }
+?>
+</table>
+ </td>
+ </tr>
+</table>
Modified: websites/bsdstats.org/releases.php
===================================================================
--- websites/bsdstats.org/releases.php 2008-09-21 18:26:48 UTC (rev 2805)
+++ websites/bsdstats.org/releases.php 2008-09-21 22:00:51 UTC (rev 2806)
@@ -1,128 +1,128 @@
-<p>
-
-<table>
- <tr>
- <td valign="top">
-<?php
- $conn = pg_pconnect("host=bsdstats.org dbname=bsdstats_new user=pgsql");
-
- $res = pg_query($conn, "select count(1) from systems where date_trunc('month', report_month) = date_trunc('month',now());");
- $data = pg_fetch_object($res, $ii);
- $num_of_systems = $data->count;
-?>
-
-<table border=1>
- <tr>
- <th>Arch</th>
- <th>Systems</th>
- <th>Percent</th>
- </tr>
-<?php
- $res = pg_query($conn, "select architecture, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now()) group by architecture order by count desc;");
- for($ii=0;$ii<pg_num_rows($res);$ii++) {
- $data = pg_fetch_object($res, $ii);
-?>
- <tr>
- <td align="right"><?php print $data->architecture ?></td>
- <td align="right"><?php print $data->count?></td>
- <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
- </tr>
-<?php
- }
-?>
-</table>
-<table border=1>
- <tr>
- <th>Release</th>
- <th>Systems</th>
- <th>Percent</th>
- </tr>
-<?php
- $res = pg_query($conn, "select substring(release from 1 for 1) || '.x' AS release, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now())group by substring(release from 1 for 1) || '.x' order by count desc;");
- for($ii=0;$ii<pg_num_rows($res);$ii++) {
- $data = pg_fetch_object($res, $ii);
-?>
- <tr>
- <td align="right"><?php print $data->release?></td>
- <td align="right"><?php print $data->count?></td>
- <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
- </tr>
-<?php
- }
-?>
-</table>
-</td><td valign="top">
-<table border=1>
- <tr>
- <th>Release</th>
- <th>Arch</th>
- <th>Systems</th>
- <th>Percent</th>
- </tr>
-<?php
- $res = pg_query($conn, "select substring(release from 1 for 1) || '.x' AS release, architecture, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now())group by substring(release from 1 for 1), architecture order by count desc;");
- for($ii=0;$ii<pg_num_rows($res);$ii++) {
- $data = pg_fetch_object($res, $ii);
-?>
- <tr>
- <td><?php print $data->release ?></td>
- <td align="right"><?php print $data->architecture ?></td>
- <td align="right"><?php print $data->count?></td>
- <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
- </tr>
-<?php
- }
-?>
-</table>
-</td><td valign="top">
-<table border=1>
- <tr>
- <th>Release</th>
- <th>Arch</th>
- <th>Systems</th>
- <th>Percent</th>
- </tr>
-<?php
- $res = pg_query($conn, "select split_part(release, '-', 1) AS release, architecture, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now()) group by split_part(release, '-', 1), architecture order by count desc;");
- for($ii=0;$ii<pg_num_rows($res);$ii++) {
- $data = pg_fetch_object($res, $ii);
-?>
- <tr>
- <td><?php print $data->release ?></td>
- <td align="right"><?php print $data->architecture ?></td>
- <td align="right"><?php print $data->count?></td>
- <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
- </tr>
-<?php
- }
-?>
-</table>
- </td>
- <td valign="top">
-<table border=1>
- <tr>
- <th>Release</th>
- <th>Arch</th>
- <th>Systems</th>
- <th>Percent</th>
- </tr>
-<?php
- $res = pg_query($conn, "SELECT release, architecture, count(1) FROM systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now()) group by release, architecture order by count desc;");
- for($ii=0;$ii<pg_num_rows($res);$ii++) {
- $data = pg_fetch_object($res, $ii);
-?>
- <tr>
- <td><?php print $data->release ?></td>
- <td align="right"><?php print $data->architecture ?></td>
- <td align="right"><?php print $data->count?></td>
- <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
- </tr>
-<?php
- }
-?>
-</table>
-
- </td>
- </tr>
-</table>
-
+<p>
+
+<table>
+ <tr>
+ <td valign="top">
+<?php
+ $conn = pg_pconnect("host=bsdstats.org dbname=bsdstats_new user=pgsql");
+
+ $res = pg_query($conn, "select count(1) from systems where date_trunc('month', report_month) = date_trunc('month',now());");
+ $data = pg_fetch_object($res);
+ $num_of_systems = $data->count;
+?>
+
+<table border=1>
+ <tr>
+ <th>Arch</th>
+ <th>Systems</th>
+ <th>Percent</th>
+ </tr>
+<?php
+ $res = pg_query($conn, "select architecture, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now()) group by architecture order by count desc;");
+ for($ii=0;$ii<pg_num_rows($res);$ii++) {
+ $data = pg_fetch_object($res, $ii);
+?>
+ <tr>
+ <td align="right"><?php print $data->architecture ?></td>
+ <td align="right"><?php print $data->count?></td>
+ <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
+ </tr>
+<?php
+ }
+?>
+</table>
+<table border=1>
+ <tr>
+ <th>Release</th>
+ <th>Systems</th>
+ <th>Percent</th>
+ </tr>
+<?php
+ $res = pg_query($conn, "select substring(release from 1 for 1) || '.x' AS release, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now())group by substring(release from 1 for 1) || '.x' order by count desc;");
+ for($ii=0;$ii<pg_num_rows($res);$ii++) {
+ $data = pg_fetch_object($res, $ii);
+?>
+ <tr>
+ <td align="right"><?php print $data->release?></td>
+ <td align="right"><?php print $data->count?></td>
+ <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
+ </tr>
+<?php
+ }
+?>
+</table>
+</td><td valign="top">
+<table border=1>
+ <tr>
+ <th>Release</th>
+ <th>Arch</th>
+ <th>Systems</th>
+ <th>Percent</th>
+ </tr>
+<?php
+ $res = pg_query($conn, "select substring(release from 1 for 1) || '.x' AS release, architecture, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now())group by substring(release from 1 for 1), architecture order by count desc;");
+ for($ii=0;$ii<pg_num_rows($res);$ii++) {
+ $data = pg_fetch_object($res, $ii);
+?>
+ <tr>
+ <td><?php print $data->release ?></td>
+ <td align="right"><?php print $data->architecture ?></td>
+ <td align="right"><?php print $data->count?></td>
+ <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
+ </tr>
+<?php
+ }
+?>
+</table>
+</td><td valign="top">
+<table border=1>
+ <tr>
+ <th>Release</th>
+ <th>Arch</th>
+ <th>Systems</th>
+ <th>Percent</th>
+ </tr>
+<?php
+ $res = pg_query($conn, "select split_part(release, '-', 1) AS release, architecture, count(1) from systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now()) group by split_part(release, '-', 1), architecture order by count desc;");
+ for($ii=0;$ii<pg_num_rows($res);$ii++) {
+ $data = pg_fetch_object($res, $ii);
+?>
+ <tr>
+ <td><?php print $data->release ?></td>
+ <td align="right"><?php print $data->architecture ?></td>
+ <td align="right"><?php print $data->count?></td>
+ <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
+ </tr>
+<?php
+ }
+?>
+</table>
+ </td>
+ <td valign="top">
+<table border=1>
+ <tr>
+ <th>Release</th>
+ <th>Arch</th>
+ <th>Systems</th>
+ <th>Percent</th>
+ </tr>
+<?php
+ $res = pg_query($conn, "SELECT release, architecture, count(1) FROM systems WHERE DATE_TRUNC('month', report_month) = DATE_TRUNC('month', now()) group by release, architecture order by count desc;");
+ for($ii=0;$ii<pg_num_rows($res);$ii++) {
+ $data = pg_fetch_object($res, $ii);
+?>
+ <tr>
+ <td><?php print $data->release ?></td>
+ <td align="right"><?php print $data->architecture ?></td>
+ <td align="right"><?php print $data->count?></td>
+ <td align="right"><?php printf("%.2f%%", ( $data->count / $num_of_systems ) * 100 ) ;?></td>
+ </tr>
+<?php
+ }
+?>
+</table>
+
+ </td>
+ </tr>
+</table>
+
More information about the Commits
mailing list