Browse Source

Merge pull request #216 from kanoi/master

miner.php add version numbers to the multi-rig summary page
nfactor-troky
Con Kolivas 13 years ago
parent
commit
ab0c1d4597
  1. 38
      miner.php

38
miner.php

@ -2,7 +2,7 @@
session_start(); session_start();
# #
global $miner, $port, $readonly, $notify, $rigs, $socktimeoutsec; global $miner, $port, $readonly, $notify, $rigs, $socktimeoutsec;
global $checklastshare; global $checklastshare, $hidefields;
# #
# Don't touch these 2 - see $rigs below # Don't touch these 2 - see $rigs below
$miner = null; $miner = null;
@ -40,6 +40,16 @@ $rigs = array('127.0.0.1:4028');
# Also, on some windows PHP, apparently the $usec is ignored # Also, on some windows PHP, apparently the $usec is ignored
$socktimeoutsec = 10; $socktimeoutsec = 10;
# #
# List of fields NOT to be displayed
# You can use this to hide data you don't want to see or don't want
# shown on a public web page
# The list of sections are: SUMMARY, POOL, PGA, GPU, NOTIFY, CONFIG
# See the web page for the list of field names (the table headers)
# It is an array of 'SECTION.Field Name' => 1
# This example would hide the slightly more sensitive pool information
#$hidefields = array('POOL.URL' => 1, 'POOL.User' => 1);
$hidefields = array();
#
$here = $_SERVER['PHP_SELF']; $here = $_SERVER['PHP_SELF'];
# #
global $tablebegin, $tableend, $warnfont, $warnoff, $dfmt; global $tablebegin, $tableend, $warnfont, $warnoff, $dfmt;
@ -151,7 +161,7 @@ function readsockline($socket)
# #
function api($cmd) function api($cmd)
{ {
global $miner, $port; global $miner, $port, $hidefields;
$socket = getsock($miner, $port); $socket = getsock($miner, $port);
if ($socket != null) if ($socket != null)
@ -186,6 +196,8 @@ function api($cmd)
if (strlen($name) == 0) if (strlen($name) == 0)
$name = 'null'; $name = 'null';
$sectionname = preg_replace('/\d/', '', $name);
if (isset($data[$name])) if (isset($data[$name]))
{ {
$num = 1; $num = 1;
@ -198,6 +210,10 @@ function api($cmd)
foreach ($items as $item) foreach ($items as $item)
{ {
$id = explode('=', $item, 2); $id = explode('=', $item, 2);
if (isset($hidefields[$sectionname.'.'.$id[0]]))
continue;
if (count($id) == 2) if (count($id) == 2)
$data[$name][$id[0]] = $id[1]; $data[$name][$id[0]] = $id[1];
else else
@ -739,7 +755,7 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
echo $tableend.$tablebegin; echo $tableend.$tablebegin;
$dthead = array('' => 1, 'STATUS' => 1, 'Description' => 1, 'When' => 1); $dthead = array('' => 1, 'STATUS' => 1, 'Description' => 1, 'When' => 1, 'API' => 1, 'CGMiner' => 1);
showhead('', null, $dthead); showhead('', null, $dthead);
foreach ($anss as $rig => $ans) foreach ($anss as $rig => $ans)
@ -748,32 +764,31 @@ function doforeach($cmd, $des, $sum, $head, $datetime)
foreach ($ans as $item => $row) foreach ($ans as $item => $row)
{ {
if ($item != 'STATUS') if ($item != 'STATUS' && $item != 'VERSION')
continue; continue;
foreach ($dthead as $name => $x) foreach ($dthead as $name => $x)
{ {
if ($name == '') if ($item == 'STATUS' && $name == '')
echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"?rig=$rig\",null)'></td>"; echo "<td align=right><input type=button value='Rig $rig' onclick='pr(\"?rig=$rig\",null)'></td>";
else else
{ {
if (isset($row[$name])) if (isset($row[$name]))
list($showvalue, $class) = fmt('STATUS', $name, $row[$name], $when, null);
else
{ {
$class = ''; list($showvalue, $class) = fmt('STATUS', $name, $row[$name], $when, null);
$showvalue = '&nbsp;';
}
echo "<td$class align=right>$showvalue</td>"; echo "<td$class align=right>$showvalue</td>";
} }
} }
} }
}
echo '</tr>'; echo '</tr>';
} }
echo $tableend; echo $tableend;
echo '<tr><td><br><br></td></tr>'; echo '<tr><td><br><br></td></tr>';
echo $tablebegin; echo $tablebegin;
return;
} }
$total = array(); $total = array();
@ -985,8 +1000,9 @@ function display()
process(array($preprocess => $preprocess), $rig); process(array($preprocess => $preprocess), $rig);
echo $tablebegin; echo $tablebegin;
doforeach('version', 'rig summary', array(), array(), true);
$sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH'); $sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH');
doforeach('summary', 'summary information', $sum, array(), true); doforeach('summary', 'summary information', $sum, array(), false);
echo $tableend; echo $tableend;
echo '<tr><td><br><br></td></tr>'; echo '<tr><td><br><br></td></tr>';
echo $tablebegin; echo $tablebegin;

Loading…
Cancel
Save