Example #1
0
 }
 // If we mine over 24 hours. Switch to donate pools.
 if ($rig_config['mining_time'] >= 86400) {
     #86400
     $mining_pools = new PoolConfig();
     if ($donate_pools_added === false) {
         $donate_pools_added = true;
         // Get actual donating pools.
         $donation_pools = json_decode(file_get_contents('https://phpminer.com/donatepools.json'), true);
         //Only process if we have some donation pools.
         if (!empty($donation_pools['donate'])) {
             // Replace old donating groups with the new one.
             $mining_pools->del_group('donate');
             $mining_pools->add_group('donate');
             foreach ($donation_pools['donate'] as $uuid => $pool) {
                 $mining_pools->add_pool($pool['url'], $pool['user'], $pool['pass'], 'donate');
             }
         }
     }
     $don_pools = $mining_pools->get_pools('donate');
     if (!empty($don_pools)) {
         // Reset mining time to 0 so we begin after donating again checking for 24 hours.
         $rig_config['mining_time'] = 0;
         $rig_config['mining_last'] = '';
         // Try to connect to default connection values.
         try {
             $rig_config['switch_back_group'] = $mining_pools->get_current_active_pool_group($main->get_rpc($rig));
             if (empty($rig_config['switch_back_group'])) {
                 $rig_config['switch_back_group'] = 'default';
             }
             $main->reload_config();