Merge pull request #572 from kanoi/master miner.php enhancements
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 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852
diff --git a/miner.php b/miner.php
index 1b935e4..d4cd09c 100644
--- a/miner.php
+++ b/miner.php
@@ -9,7 +9,7 @@ global $rigipsecurity, $rigtotals, $forcerigtotals;
global $socksndtimeoutsec, $sockrcvtimeoutsec;
global $checklastshare, $poolinputs, $hidefields;
global $ignorerefresh, $changerefresh, $autorefresh;
-global $allowcustompages, $customsummarypages;
+global $allowcustompages, $customsummarypages, $user_pages;
global $miner_font_family, $miner_font_size;
global $bad_font_family, $bad_font_size, $add_css_names;
global $colouroverride, $placebuttons, $userlist;
@@ -126,71 +126,287 @@ $allowcustompages = true;
$mobilepage = array(
'DATE' => null,
'RIGS' => null,
- 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', 'Accepted', 'Rejected=Rej', 'Utility'),
- 'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID', 'DEVS.Status=Status', 'DEVS.Temperature=Temp',
- 'DEVS.MHS av=MHS av', 'DEVS.Accepted=Accept', 'DEVS.Rejected=Rej',
- 'DEVS.Utility=Utility', 'NOTIFY.Last Not Well=Not Well'),
- 'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected=Rej', 'Last Share Time'));
+ 'SUMMARY' => array('Elapsed', 'MHS av', 'MHS 5m', 'Found Blocks=Blks',
+ 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR',
+ 'Hardware Errors=HW',
+ 'Work Utility=WU'),
+ 'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID', 'DEVS.Status=Status',
+ 'DEVS.Temperature=Temp', 'DEVS.MHS av=MHS av',
+ 'DEVS.MHS 5m=MHS 5m', 'DEVS.Difficulty Accepted=DiffA',
+ 'DEVS.Difficulty Rejected=DiffR',
+ 'DEVS.Work Utility=WU',
+ 'NOTIFY.Last Not Well=Not Well'),
+ 'POOL' => array('POOL', 'Status', 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR', 'Last Share Time=LST'));
$mobilesum = array(
- 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'),
- 'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Accepted', 'DEVS.Rejected', 'DEVS.Utility'),
- 'POOL' => array('Accepted', 'Rejected'));
+ 'SUMMARY' => array('MHS av', 'MHS 5m', 'Found Blocks', 'Difficulty Accepted',
+ 'Difficulty Rejected', 'Hardware Errors',
+ 'Work Utility'),
+ 'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Difficulty Accepted',
+ 'DEVS.Difficulty Rejected'),
+ 'POOL' => array('Difficulty Accepted', 'Difficulty Rejected'));
#
$statspage = array(
'DATE' => null,
'RIGS' => null,
- 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks',
- 'Accepted', 'Rejected=Rej', 'Utility',
- 'Hardware Errors=HW Errs', 'Network Blocks=Net Blks',
- 'Work Utility'),
+ 'SUMMARY' => array('Elapsed', 'MHS av', 'MHS 5m', 'Found Blocks=Blks',
+ 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR',
+ 'Work Utility=WU', 'Hardware Errors=HW Errs',
+ 'Network Blocks=Net Blks'),
'COIN' => array('*'),
'STATS' => array('*'));
#
$statssum = array(
- 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted',
- 'Rejected', 'Utility', 'Hardware Errors',
- 'Work Utility'));
+ 'SUMMARY' => array('MHS av', 'MHS 5m', 'Found Blocks',
+ 'Difficulty Accepted', 'Difficulty Rejected',
+ 'Work Utility', 'Hardware Errors'));
#
$poolspage = array(
'DATE' => null,
'RIGS' => null,
- 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', 'Accepted', 'Rejected=Rej',
- 'Utility', 'Hardware Errors=HW Errs', 'Network Blocks=Net Blks',
- 'Work Utility'),
- 'POOL+STATS' => array('STATS.ID=ID', 'POOL.URL=URL', 'POOL.Difficulty Accepted=Diff Acc',
- 'POOL.Difficulty Rejected=Diff Rej',
- 'POOL.Has Stratum=Stratum', 'POOL.Stratum Active=StrAct',
+ 'SUMMARY' => array('Elapsed', 'MHS av', 'MHS 5m', 'Found Blocks=Blks',
+ 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR',
+ 'Work Utility', 'Hardware Errors=HW',
+ 'Network Blocks=Net Blks'),
+ 'POOL+STATS' => array('STATS.ID=ID', 'POOL.URL=URL',
+ 'POOL.Difficulty Accepted=DiffA',
+ 'POOL.Difficulty Rejected=DiffR',
+ 'POOL.Has Stratum=Stratum',
+ 'POOL.Stratum Active=StrAct',
'POOL.Has GBT=GBT', 'STATS.Times Sent=TSent',
'STATS.Bytes Sent=BSent', 'STATS.Net Bytes Sent=NSent',
'STATS.Times Recv=TRecv', 'STATS.Bytes Recv=BRecv',
'STATS.Net Bytes Recv=NRecv', 'GEN.AvShr=AvShr'));
#
$poolssum = array(
- 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted',
- 'Rejected', 'Utility', 'Hardware Errors',
- 'Work Utility'),
+ 'SUMMARY' => array('MHS av', 'MHS 5m', 'Found Blocks',
+ 'Difficulty Accepted', 'Difficulty Rejected',
+ 'Work Utility', 'Hardware Errors'),
'POOL+STATS' => array('POOL.Difficulty Accepted', 'POOL.Difficulty Rejected',
- 'STATS.Times Sent', 'STATS.Bytes Sent', 'STATS.Net Bytes Sent',
- 'STATS.Times Recv', 'STATS.Bytes Recv', 'STATS.Net Bytes Recv'));
+ 'STATS.Times Sent', 'STATS.Bytes Sent',
+ 'STATS.Net Bytes Sent', 'STATS.Times Recv',
+ 'STATS.Bytes Recv', 'STATS.Net Bytes Recv'));
#
$poolsext = array(
'POOL+STATS' => array(
'where' => null,
- 'group' => array('POOL.URL', 'POOL.Has Stratum', 'POOL.Stratum Active', 'POOL.Has GBT'),
- 'calc' => array('POOL.Difficulty Accepted' => 'sum', 'POOL.Difficulty Rejected' => 'sum',
- 'STATS.Times Sent' => 'sum', 'STATS.Bytes Sent' => 'sum',
- 'STATS.Net Bytes Sent' => 'sum', 'STATS.Times Recv' => 'sum',
- 'STATS.Bytes Recv' => 'sum', 'STATS.Net Bytes Recv' => 'sum',
+ 'group' => array('POOL.URL', 'POOL.Has Stratum',
+ 'POOL.Stratum Active', 'POOL.Has GBT'),
+ 'calc' => array('POOL.Difficulty Accepted' => 'sum',
+ 'POOL.Difficulty Rejected' => 'sum',
+ 'STATS.Times Sent' => 'sum',
+ 'STATS.Bytes Sent' => 'sum',
+ 'STATS.Net Bytes Sent' => 'sum',
+ 'STATS.Times Recv' => 'sum',
+ 'STATS.Bytes Recv' => 'sum',
+ 'STATS.Net Bytes Recv' => 'sum',
'POOL.Accepted' => 'sum'),
- 'gen' => array('AvShr' => 'round(POOL.Difficulty Accepted/max(POOL.Accepted,1)*100)/100'),
+ 'gen' => array('AvShr' =>
+ 'round(POOL.Difficulty Accepted/'.
+ 'max(POOL.Accepted,1)*100)/100'),
'having' => array(array('STATS.Bytes Recv', '>', 0)))
);
-
#
-# customsummarypages is an array of these Custom Summary Pages
-$customsummarypages = array('Mobile' => array($mobilepage, $mobilesum),
- 'Stats' => array($statspage, $statssum),
- 'Pools' => array($poolspage, $poolssum, $poolsext));
+$devnotpage = array(
+ 'DATE' => null,
+ 'RIGS' => null,
+ 'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID',
+ 'DEVS.Temperature=Temp', 'DEVS.MHS av=MHS av',
+ 'DEVS.Difficulty Accepted=DiffA',
+ 'DEVS.Difficulty Rejected=DiffR',
+ 'NOTIFY.Last Not Well=Last Not Well'));
+$devnotsum = array(
+ 'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Difficulty Accepted',
+ 'DEVS.Difficulty Rejected'));
+#
+$devdetpage = array(
+ 'DATE' => null,
+ 'RIGS' => null,
+ 'DEVS+DEVDETAILS' => array('DEVS.Name=Name', 'DEVS.ID=ID',
+ 'DEVS.Temperature=Temp',
+ 'DEVS.MHS av=MHS av',
+ 'DEVS.Difficulty Accepted=DiffA',
+ 'DEVS.Difficulty Rejected=DiffR',
+ 'DEVDETAILS.Device Path=Device'));
+$devdetsum = array(
+ 'DEVS+DEVDETAILS' => array('DEVS.MHS av', 'DEVS.Difficulty Accepted',
+ 'DEVS.Difficulty Rejected'));
+#
+$protopage = array(
+ 'DATE' => null,
+ 'RIGS' => null,
+ 'CONFIG' => array('ASC Count=ASCs', 'PGA Count=PGAs', 'Pool Count=Pools',
+ 'Strategy', 'Device Code', 'OS', 'Failover-Only'),
+ 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks',
+ 'Difficulty Accepted=Diff Acc',
+ 'Difficulty Rejected=Diff Rej',
+ 'Hardware Errors=HW Errs',
+ 'Network Blocks=Net Blks', 'Utility', 'Work Utility'),
+ 'POOL+STATS' => array('STATS.ID=ID', 'POOL.URL=URL', 'POOL.Accepted=Acc',
+ 'POOL.Difficulty Accepted=DiffA',
+ 'POOL.Difficulty Rejected=DiffR', 'POOL.Has GBT=GBT',
+ 'STATS.Max Diff=Max Work Diff',
+ 'STATS.Times Sent=#Sent', 'STATS.Bytes Sent=Byte Sent',
+ 'STATS.Net Bytes Sent=Net Sent',
+ 'STATS.Times Recv=#Recv',
+ 'STATS.Bytes Recv=Byte Recv',
+ 'STATS.Net Bytes Recv=Net Recv'));
+$protosum = array(
+ 'SUMMARY' => array('MHS av', 'Found Blocks', 'Difficulty Accepted',
+ 'Difficulty Rejected', 'Hardware Errors',
+ 'Utility', 'Work Utility'),
+ 'POOL+STATS' => array('POOL.Accepted', 'POOL.Difficulty Accepted',
+ 'POOL.Difficulty Rejected',
+ 'STATS.Times Sent', 'STATS.Bytes Sent',
+ 'STATS.Net Bytes Sent', 'STATS.Times Recv',
+ 'STATS.Bytes Recv', 'STATS.Net Bytes Recv'));
+$protoext = array(
+ 'POOL+STATS' => array(
+ 'where' => null,
+ 'group' => array('POOL.URL', 'POOL.Has GBT'),
+ 'calc' => array('POOL.Accepted' => 'sum',
+ 'POOL.Difficulty Accepted' => 'sum',
+ 'POOL.Difficulty Rejected' => 'sum',
+ 'STATS.Max Diff' => 'max',
+ 'STATS.Times Sent' => 'sum',
+ 'STATS.Bytes Sent' => 'sum',
+ 'STATS.Net Bytes Sent' => 'sum',
+ 'STATS.Times Recv' => 'sum',
+ 'STATS.Bytes Recv' => 'sum',
+ 'STATS.Net Bytes Recv' => 'sum'),
+ 'having' => array(array('STATS.Bytes Recv', '>', 0)))
+);
+#
+# If 'gen' isn't enabled, the 'GEN' fields won't show but
+# where present, will be replaced with the ||SUMMARY fields
+$kanogenpage = array(
+ 'DATE' => null,
+ 'RIGS' => null,
+ 'SUMMARY+COIN' => array('SUMMARY.Elapsed=Elapsed',
+ 'GEN.Mined=Block%', 'GEN.GHS Acc=GH/s Acc',
+ 'GEN.GHS av=GH/s av||SUMMARY.MHS av=MHS av',
+ 'GEN.GHS 5m=GH/s 5m||SUMMARY.MHS 5m=MHS 5m',
+ 'GEN.GHS WU=GH/s WU||SUMMARY.Work Utility=WU',
+ 'SUMMARY.Found Blocks=Blks',
+ 'SUMMARY.Difficulty Accepted=DiffA',
+ 'SUMMARY.Difficulty Rejected=DiffR',
+ 'SUMMARY.Hardware Errors=HW',
+ 'SUMMARY.Difficulty Stale=DiffS',
+ 'SUMMARY.Best Share=Best Share',
+ 'SUMMARY.Device Hardware%=Dev HW%',
+ 'SUMMARY.Device Rejected%=Dev Rej%',
+ 'SUMMARY.Pool Rejected%=Pool Rej%',
+ 'SUMMARY.Pool Stale%=Pool Stale%'),
+ 'POOL' => array('URL', 'Diff1 Shares=Diff Work',
+ 'Difficulty Accepted=DiffA',
+ 'Difficulty Rejected=DiffR',
+ 'Difficulty Stale=DiffS',
+ 'Best Share', 'GEN.Acc=Acc%', 'GEN.Rej=Rej%')
+);
+# sum should list all fields seperately including GEN/BGEN || replacements
+$kanogensum = array(
+ 'SUMMARY+COIN' => array('GEN.Mined', 'GEN.GHS Acc', 'GEN.GHS av',
+ 'GEN.GHS 5m', 'GEN.GHS WU',
+ 'SUMMARY.MHS av', 'SUMMARY.MHS 5m',
+ 'SUMMARY.Work Utility',
+ 'SUMMARY.Found Blocks',
+ 'SUMMARY.Difficulty Accepted',
+ 'SUMMARY.Difficulty Rejected',
+ 'SUMMARY.Hardware Errors',
+ 'SUMMARY.Difficulty Stale'),
+ 'POOL' => array('Diff1 Shares', 'Difficulty Accepted',
+ 'Difficulty Rejected', 'Difficulty Stale')
+);
+# 'where', 'calc' and 'having' should list GEN/BGEN || replacements seperately
+# 'group' must use the 'name1||name2' format for GEN/BGEN fields
+$kanogenext = array(
+ 'SUMMARY+COIN' => array(
+ 'gen' => array('GHS Acc' =>
+ 'round(pow(2,32) * SUMMARY.Difficulty Accepted / '.
+ 'SUMMARY.Elapsed / 10000000) / 100',
+ 'Mined' =>
+ 'SUMMARY.Elapsed * SUMMARY.Work Utility / 60 / '.
+ 'COIN.Network Difficulty',
+ 'GHS av' =>
+ 'SUMMARY.MHS av / 1000.0',
+ 'GHS 5m' =>
+ 'SUMMARY.MHS 5m / 1000.0',
+ 'GHS WU' =>
+ 'round(pow(2,32) * SUMMARY.Work Utility / 60 / '.
+ '10000000 ) / 100')),
+ 'POOL' => array(
+ 'group' => array('URL'),
+ 'calc' => array('Diff1 Shares' => 'sum', 'Difficulty Accepted' => 'sum',
+ 'Difficulty Rejected' => 'sum',
+ 'Difficulty Stale' => 'sum', 'Best Share' => 'max'),
+ 'gen' => array('Rej' => 'Difficulty Rejected / max(1,Diff1 Shares)',
+ '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
+# and it can be a fully defined 'Name' => array(...) like in $sys_pages below
+$customsummarypages = array(
+ 'Kano' => 1,
+ 'Mobile' => 1,
+ 'Stats' => 1,
+ 'Pools' => 1
+);
+#
+# $user_pages are the myminer.php definable version of $sys_pages
+# It should contain a set of 'Name' => array(...) like in $sys_pages
+# that $customsummarypages can refer to by 'Name'
+# If a 'Name' is in both $user_pages and $sys_pages, then the one
+# in $user_pages will override the one in $sys_pages
+$user_pages = array();
#
$here = $_SERVER['PHP_SELF'];
#
@@ -260,6 +476,20 @@ $colourtable = array(
'td.lo background' => '#deffff'
);
#
+# A list of system default summary pages (defined further above)
+# that you can use by 'Name' in $customsummarypages
+global $sys_pages;
+$sys_pages = array(
+ 'Mobile' => array($mobilepage, $mobilesum),
+ 'Stats' => array($statspage, $statssum),
+ 'Pools' => array($poolspage, $poolssum, $poolsext),
+ 'DevNot' => array($devnotpage, $devnotsum),
+ 'DevDet' => array($devdetpage, $devdetsum),
+ 'Proto' => array($protopage, $protosum, $protoext),
+ 'Kano' => array($kanogenpage, $kanogensum, $kanogenext),
+ 'Summary' => array($syspage, $syssum)
+);
+#
# Don't touch these 2
$miner = null;
$port = null;
@@ -271,10 +501,6 @@ $rigips = array();
global $showndate;
$showndate = false;
#
-# For summary page to stop retrying failed rigs
-global $rigerror;
-$rigerror = array();
-#
global $rownum;
$rownum = 0;
#
@@ -282,6 +508,91 @@ $rownum = 0;
global $ses;
$ses = 'rutroh';
#
+function getcsp($name, $systempage = false)
+{
+ global $customsummarypages, $user_pages, $sys_pages;
+
+ if ($systempage === false)
+ {
+ if (!isset($customsummarypages[$name]))
+ return false;
+
+ $csp = $customsummarypages[$name];
+ if (is_array($csp))
+ {
+ if (count($csp) < 2 || count($csp) > 3)
+ return false;
+ else
+ return $csp;
+ }
+ }
+
+ if (isset($user_pages[$name]))
+ {
+ $csp = $user_pages[$name];
+ if (!is_array($csp) || count($csp) < 2 || count($csp) > 3)
+ return false;
+ else
+ return $csp;
+ }
+
+ if (isset($sys_pages[$name]))
+ {
+ $csp = $sys_pages[$name];
+ if (!is_array($csp) || count($csp) < 2 || count($csp) > 3)
+ return false;
+ else
+ return $csp;
+ }
+
+ return false;
+}
+#
+function degenfields(&$sec, $name, $fields)
+{
+ global $allowgen;
+
+ if (!is_array($fields))
+ return;
+
+ foreach ($fields as $num => $fld)
+ if (substr($fld, 0, 5) == 'BGEN.' || substr($fld, 0, 4) == 'GEN.')
+ {
+ $opts = explode('||', $fld, 2);
+ if ($allowgen)
+ {
+ if (count($opts) > 1)
+ $sec[$name][$num] = $opts[0];
+ }
+ else
+ {
+ if (count($opts) > 1)
+ $sec[$name][$num] = $opts[1];
+ else
+ unset($sec[$name][$num]);
+ }
+ }
+}
+#
+# Allow BGEN/GEN fields to have a '||' replacement when gen is disabled
+# N.B. if gen is disabled and all page fields are GBEN/GEN without '||' then
+# the table will disappear
+# Replacements can be in the page fields and then also the ext group fields
+# All other $csp sections should list both separately
+function degen(&$csp)
+{
+ $page = 0;
+ if (isset($csp[$page]) && is_array($csp[$page]))
+ foreach ($csp[$page] as $sec => $fields)
+ degenfields($csp[$page], $sec, $fields);
+
+ $ext = 2;
+ if (isset($csp[$ext]) && is_array($csp[$ext]))
+ foreach ($csp[$ext] as $sec => $types)
+ if (is_array($types) && isset($types['group']))
+ degenfields($types, 'group', $types['group']);
+}
+#
function getcss($cssname, $dom = false)
{
global $colourtable, $colouroverride;
@@ -1025,6 +1336,9 @@ function fmt($section, $name, $value, $when, $alldata, $cf = NULL)
break;
case 'MHS av':
case 'MHS 5s':
+ case 'MHS 1m':
+ case 'MHS 5m':
+ case 'MHS 15m':
$parts = explode('.', $value, 2);
if (count($parts) == 1)
$dec = '';
@@ -1136,6 +1450,23 @@ function fmt($section, $name, $value, $when, $alldata, $cf = NULL)
case 'Pool':
case 'GPU':
break;
+ // Kano GEN fields
+ case 'Mined':
+ if ($value != '')
+ $ret = number_format((float)$value * 100.0, 3) . '%';
+ break;
+ case 'Acc':
+ case 'Rej':
+ if ($value != '')
+ $ret = number_format((float)$value * 100.0, 2) . '%';
+ break;
+ case 'GHS av':
+ case 'GHS 5m':
+ case 'GHS WU':
+ case 'GHS Acc':
+ if ($value != '')
+ $ret = number_format((float)$value, 2);
+ break;
}
}
@@ -1617,168 +1948,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;
@@ -1840,7 +2009,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)'> ";
}
@@ -1857,7 +2026,8 @@ function pagebuttons($rig, $pg)
}
foreach ($list as $pagename => $data)
- echo "<input type=button value='$pagename' onclick='pr(\"&pg=$pagename\",null)'> ";
+ if (getcsp($pagename) !== false)
+ echo "<input type=button value='$pagename' onclick='pr(\"&pg=$pagename\",null)'> ";
}
echo '</td><td width=100%> </td><td nowrap>';
@@ -2425,6 +2595,13 @@ function ss($a, $b)
return strcmp($a, $b);
}
#
+# If you are developing a customsummarypage that uses BGEN or GEN,
+# you may want to remove the '@' in front of '@eval()' to help with debugging
+# The '@' removes php comments from the web log about missing fields
+# Since there are many forks of cgminer that break the API or do not
+# keep their fork up to date with current cgminer, the addition of
+# '@' solves the problem of generating unnecessary and excessive web logs
+# about the eval()
function genfld($row, $calc)
{
uksort($row, "ss");
@@ -2433,7 +2610,7 @@ function genfld($row, $calc)
if (strstr($calc, $name) !== FALSE)
$calc = str_replace($name, $value, $calc);
- eval("\$val = $calc;");
+ @eval("\$val = $calc;");
if (!isset($val))
return '';
@@ -2518,9 +2695,12 @@ function processext($ext, $section, $res, &$fields)
if ($calc !== null)
foreach ($calc as $field => $func)
{
- if (!isset($interim[$grpkey]['cal'][$field]))
- $interim[$grpkey]['cal'][$field] = array();
- $interim[$grpkey]['cal'][$field][] = $row[$field];
+ if (isset($row[$field]))
+ {
+ if (!isset($interim[$grpkey]['cal'][$field]))
+ $interim[$grpkey]['cal'][$field] = array();
+ $interim[$grpkey]['cal'][$field][] = $row[$field];
+ }
}
}
}
@@ -2735,7 +2915,7 @@ function processcustompage($pagename, $sections, $sum, $ext, $namemap)
}
}
#
-function showcustompage($pagename)
+function showcustompage($pagename, $systempage = false)
{
global $customsummarypages;
global $placebuttons;
@@ -2743,22 +2923,22 @@ 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;
}
- $c = count($customsummarypages[$pagename]);
- if ($c < 2 || $c > 3)
+ $csp = getcsp($pagename, $systempage);
+ if ($csp === false)
{
- $rw = "<td colspan=100 class=bad>Invalid custom summary page '$pagename' (";
- $rw .= count($customsummarypages[$pagename]).')</td>';
- otherrow($rw);
+ otherrow("<td colspan=100 class=bad>Invalid custom summary page '$pagename'</td>");
return;
}
- $page = $customsummarypages[$pagename][0];
+ degen($csp);
+
+ $page = $csp[0];
$namemap = array();
foreach ($page as $name => $fields)
{
@@ -2779,10 +2959,10 @@ function showcustompage($pagename)
}
$ext = null;
- if (isset($customsummarypages[$pagename][2]))
- $ext = $customsummarypages[$pagename][2];
+ if (isset($csp[2]))
+ $ext = $csp[2];
- $sum = $customsummarypages[$pagename][1];
+ $sum = $csp[1];
if ($sum === null)
$sum = array();
@@ -2842,7 +3022,7 @@ function onlylogin()
#
function checklogin()
{
- global $allowcustompages, $customsummarypages;
+ global $allowcustompages;
global $readonly, $userlist, $ses;
$out = trim(getparam('logout', true));
@@ -2900,7 +3080,7 @@ function checklogin()
{
// Ensure at least one exists
foreach ($userlist['def'] as $pg)
- if (isset($customsummarypages[$pg]))
+ if (getcsp($pg) !== false)
return true;
}
@@ -2914,7 +3094,7 @@ function display()
global $mcast, $mcastexpect;
global $readonly, $notify, $rigs;
global $ignorerefresh, $autorefresh;
- global $allowcustompages, $customsummarypages;
+ global $allowcustompages;
global $placebuttons;
global $userlist, $ses;
@@ -2990,7 +3170,7 @@ function display()
{
if ($userlist !== null && isset($userlist['def']))
foreach ($userlist['def'] as $pglook)
- if (isset($customsummarypages[$pglook]))
+ if (getcsp($pglook) !== false)
{
$pg = $pglook;
break;
@@ -3001,7 +3181,7 @@ function display()
if ($pg !== null && $pg !== '')
{
htmlhead($mcerr, false, null, $pg);
- showcustompage($pg, $mcerr);
+ showcustompage($pg);
return;
}
}
@@ -3060,28 +3240,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)