miner.php make Summary a custompage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
diff --git a/miner.php b/miner.php
index b52834e..3afc4d3 100644
--- a/miner.php
+++ b/miner.php
@@ -339,6 +339,50 @@ $kanogenext = array(
'Acc' => 'Difficulty Accepted / max(1,Diff1 Shares)'))
);
#
+$syspage = array(
+ 'DATE' => null,
+ 'RIGS' => null,
+ 'SUMMARY' => array('#', 'Elapsed', 'MHS av', 'MHS 5m', 'Found Blocks=Blks',
+ 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR',
+ 'Difficulty Stale=DiffS', 'Hardware Errors=HW',
+ 'Work Utility', 'Network Blocks=Net Blks', 'Total MH',
+ 'Best Share', 'Device Hardware%=Dev HW%',
+ 'Device Rejected%=Dev Rej%',
+ 'Pool Rejected%=Pool Rej%', 'Pool Stale%',
+ 'Last getwork'),
+ 'DEVS' => array('#', 'ID', 'Name', 'ASC', 'Device Elapsed', 'Enabled',
+ 'Status', 'No Device', 'Temperature=Temp',
+ 'MHS av', 'MHS 5s', 'MHS 5m', 'Diff1 Work',
+ 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR',
+ 'Hardware Errors=HW', 'Work Utility',
+ 'Last Valid Work', 'Last Share Pool',
+ 'Last Share Time', 'Total MH',
+ 'Device Hardware%=Dev HW%',
+ 'Device Rejected%=Dev Rej%'),
+ 'POOL' => array('POOL', 'URL', 'Status', 'Priority', 'Quota',
+ 'Getworks', 'Diff1 Shares',
+ 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR',
+ 'Difficulty Stale=DiffS',
+ 'Last Share Difficulty',
+ 'Last Share Time',
+ 'Best Share', 'Pool Rejected%=Pool Rej%',
+ 'Pool Stale%')
+);
+$syssum = array(
+ 'SUMMARY' => array('MHS av', 'MHS 5m', 'Found Blocks',
+ 'Difficulty Accepted', 'Difficulty Rejected',
+ 'Difficulty Stale', 'Hardware Errors',
+ 'Work Utility', 'Total MH'),
+ 'DEVS' => array('MHS av', 'MHS 5s', 'MHS 5m', 'Diff1 Work',
+ 'Difficulty Accepted', 'Difficulty Rejected',
+ 'Hardware Errors', 'Total MH'),
+ 'POOL' => array('Getworks', 'Diff1 Shares', 'Difficulty Accepted',
+ 'Difficulty Rejected', 'Difficulty Stale')
+);
+#
# $customsummarypages is an array of these Custom Summary Pages
# that you can override in myminer.php
# It can be 'Name' => 1 with 'Name' in any of $user_pages or $sys_pages
@@ -435,7 +479,8 @@ $sys_pages = array(
'DevNot' => array($devnotpage, $devnotsum),
'DevDet' => array($devdetpage, $devdetsum),
'Proto' => array($protopage, $protosum, $protoext),
- 'Kano' => array($kanogenpage, $kanogensum, $kanogenext)
+ 'Kano' => array($kanogenpage, $kanogensum, $kanogenext),
+ 'Summary' => array($syspage, $syssum)
);
#
# Don't touch these 2
@@ -460,20 +505,23 @@ $rownum = 0;
global $ses;
$ses = 'rutroh';
#
-function getcsp($name)
+function getcsp($name, $systempage = false)
{
global $customsummarypages, $user_pages, $sys_pages;
- if (!isset($customsummarypages[$name]))
- return false;
-
- $csp = $customsummarypages[$name];
- if (is_array($csp))
+ if ($systempage === false)
{
- if (count($csp) < 2 || count($csp) > 3)
+ if (!isset($customsummarypages[$name]))
return false;
- else
- return $csp;
+
+ $csp = $customsummarypages[$name];
+ if (is_array($csp))
+ {
+ if (count($csp) < 2 || count($csp) > 3)
+ return false;
+ else
+ return $csp;
+ }
}
if (isset($user_pages[$name]))
@@ -1849,168 +1897,6 @@ function showrigs($anss, $headname, $rigname)
}
}
#
-# $head is a hack but this is just a demo anyway :)
-function doforeach($cmd, $des, $sum, $head, $datetime)
-{
- global $miner, $port;
- global $error, $readonly, $notify, $rigs, $rigbuttons;
- global $warnfont, $warnoff, $dfmt;
- global $rigerror;
-
- $when = 0;
-
- $header = $head;
- $anss = array();
-
- $count = 0;
- $preverr = count($rigerror);
- foreach ($rigs as $num => $rig)
- {
- $anss[$num] = null;
-
- if (isset($rigerror[$rig]))
- continue;
-
- $parts = explode(':', $rig, 3);
- if (count($parts) >= 1)
- {
- $miner = $parts[0];
- if (count($parts) >= 2)
- $port = $parts[1];
- else
- $port = '';
-
- if (count($parts) > 2)
- $name = $parts[2];
- else
- $name = $num;
-
- $ans = api($name, $cmd);
-
- if ($error != null)
- {
- $rw = "<td colspan=100>Error on rig $name getting ";
- $rw .= "$des: $warnfont$error$warnoff</td>";
- otherrow($rw);
- $rigerror[$rig] = $error;
- $error = null;
- }
- else
- {
- $anss[$num] = $ans;
- $count++;
- }
- }
- }
-
- if ($count == 0)
- {
- $rw = '<td>Failed to access any rigs successfully';
- if ($preverr > 0)
- $rw .= ' (or rigs had previous errors)';
- $rw .= '</td>';
- otherrow($rw);
- return;
- }
-
- if ($datetime)
- {
- showdatetime();
- endtable();
- newtable();
- showrigs($anss, '', 'Rig ');
- endtable();
- otherrow('<td><br><br></td>');
- newtable();
-
- return;
- }
-
- $total = array();
-
- foreach ($anss as $rig => $ans)
- {
- if ($ans == null)
- continue;
-
- foreach ($ans as $item => $row)
- {
- if ($item == 'STATUS')
- continue;
-
- if (count($row) > count($header))
- {
- $header = $head;
- foreach ($row as $name => $value)
- if (!isset($header[$name]))
- $header[$name] = '';
- }
-
- if ($sum != null)
- foreach ($sum as $name)
- {
- if (isset($row[$name]))
- {
- if (isset($total[$name]))
- $total[$name] += $row[$name];
- else
- $total[$name] = $row[$name];
- }
- }
- }
- }
-
- if ($sum != null)
- $anss['total']['total'] = $total;
-
- showhead('', $header);
-
- foreach ($anss as $rig => $ans)
- {
- if ($ans == null)
- continue;
-
- $when = 0;
- if (isset($ans['STATUS']['When']))
- $when = $ans['STATUS']['When'];
-
- foreach ($ans as $item => $row)
- {
- if ($item == 'STATUS')
- continue;
-
- newrow();
-
- $section = preg_replace('/\d/', '', $item);
-
- foreach ($header as $name => $x)
- {
- if ($name == '')
- {
- if ($rig === 'total')
- {
- list($ignore, $class) = fmt($rig, '', '', $when, $row);
- echo "<td align=right$class>Total:</td>";
- }
- else
- echo rigbutton($rig, "Rig $rig", $when, $row, $rigbuttons);
- }
- else
- {
- if (isset($row[$name]))
- $value = $row[$name];
- else
- $value = null;
-
- list($showvalue, $class) = fmt($section, $name, $value, $when, $row);
- echo "<td$class align=right>$showvalue</td>";
- }
- }
- endrow();
- }
- }
-}
-#
function refreshbuttons()
{
global $ignorerefresh, $changerefresh, $autorefresh;
@@ -2072,7 +1958,7 @@ function pagebuttons($rig, $pg)
if ($next !== null)
echo riginput($next, 'Next', true).' ';
echo ' ';
- if (count($rigs) > 1)
+ if (count($rigs) > 1 and getcsp('Summary', true) !== false)
echo "<input type=button value='Summary' onclick='pr(\"\",null)'> ";
}
@@ -2968,7 +2854,7 @@ function processcustompage($pagename, $sections, $sum, $ext, $namemap)
}
}
#
-function showcustompage($pagename)
+function showcustompage($pagename, $systempage = false)
{
global $customsummarypages;
global $placebuttons;
@@ -2976,13 +2862,13 @@ function showcustompage($pagename)
if ($placebuttons == 'top' || $placebuttons == 'both')
pagebuttons(null, $pagename);
- if (!isset($customsummarypages[$pagename]))
+ if ($systempage === false && !isset($customsummarypages[$pagename]))
{
otherrow("<td colspan=100 class=bad>Unknown custom summary page '$pagename'</td>");
return;
}
- $csp = getcsp($pagename);
+ $csp = getcsp($pagename, $systempage);
if ($csp === false)
{
otherrow("<td colspan=100 class=bad>Invalid custom summary page '$pagename'</td>");
@@ -3232,7 +3118,7 @@ function display()
if ($pg !== null && $pg !== '')
{
htmlhead($mcerr, false, null, $pg);
- showcustompage($pg, $mcerr);
+ showcustompage($pg);
return;
}
}
@@ -3291,28 +3177,11 @@ function display()
htmlhead($mcerr, false, null);
- if ($placebuttons == 'top' || $placebuttons == 'both')
- pagebuttons(null, null);
-
if ($preprocess != null)
process(array($preprocess => $preprocess), $rig);
- newtable();
- doforeach('version', 'rig summary', array(), array(), true);
- $sum = array('MHS av', 'Getworks', 'Found Blocks', 'Accepted', 'Rejected', 'Discarded', 'Stale', 'Utility', 'Local Work', 'Total MH', 'Work Utility', 'Diff1 Shares', 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected', 'Difficulty Stale');
- doforeach('summary', 'summary information', $sum, array(), false);
- endtable();
- otherrow('<td><br><br></td>');
- newtable();
- doforeach('devs', 'device list', $sum, array(''=>'','ID'=>'','Name'=>''), false);
- endtable();
- otherrow('<td><br><br></td>');
- newtable();
- doforeach('pools', 'pool list', $sum, array(''=>''), false);
- endtable();
-
- if ($placebuttons == 'bot' || $placebuttons == 'both')
- pagebuttons(null, null);
+ if (getcsp('Summary', true) !== false)
+ showcustompage('Summary', true);
}
#
if ($mcast === true)