Пример #1
0
 private function calculateCounters($version, $lastRun)
 {
     $countersInfo = array('newEntry' => 0, 'updateCounters' => 0, 'channelCountries' => 0, 'channelTotal' => 0, 'channelPass' => 0, 'channelFail' => 0, 'channelNA' => 0, 'eirpCountries' => 0, 'EIRPTotal' => 0, 'EIRPPass' => 0, 'EIRPFail' => 0, 'EIRPNA' => 0);
     $newEntry = 0;
     $updateCounters = 0;
     $con_3 = regulatory_dbconnect();
     $sql_query = "select * from regulatoryResults where version like '%{$version['versionDottedQuad']}%' and build like '%{$version['buildNum']}%' ";
     $result = mysql_query($sql_query);
     $num_rows = mysql_num_rows($result);
     if ($num_rows == 0) {
         $newEntry = 1;
     }
     if ($newEntry == 0) {
         $sql_query = "select * from regulatoryResults where version like '%{$version['versionDottedQuad']}%' and build like '%{$version['buildNum']}%' ";
         $result = mysql_query($sql_query);
         $num_rows = mysql_num_rows($result);
         regulatory_dbclose($con_3);
         if ($num_rows == 1) {
             $updateCounters = 1;
         }
     }
     $countersInfo['newEntry'] = $newEntry;
     $countersInfo['updateCounters'] = $updateCounters;
     if ($newEntry == 1 || $updateCounters == 1) {
         $obj1 = new regulatoryResults($version[versionDottedQuad], $version[buildNum], "Channel", "");
         $channelResult = $obj1->getRegulatoryData();
         $countersInfo['channelCountries'] = count($channelResult);
         $obj2 = new regulatoryResults($version[versionDottedQuad], $version[buildNum], "EIRP", "");
         $EIRPResult = $obj2->getRegulatoryData();
         $countersInfo['eirpCountries'] = count($EIRPResult);
         foreach ($channelResult as $countryChannelResult) {
             foreach ($countryChannelResult as $apChannelResult) {
                 switch ($apChannelResult['result']) {
                     case 'pass':
                         $countersInfo['channelPass']++;
                         break;
                     case 'fail':
                         $countersInfo['channelFail']++;
                         break;
                     case 'N/A':
                         $countersInfo['channelNA']++;
                         break;
                 }
                 // switch
                 $countersInfo['channelTotal']++;
             }
         }
         // inner foreach
         foreach ($EIRPResult as $countryEIRPResult) {
             foreach ($countryEIRPResult as $apEIRPResult) {
                 switch ($apEIRPResult['result']) {
                     case 'pass':
                         $countersInfo['EIRPPass']++;
                         break;
                     case 'fail':
                         $countersInfo['EIRPFail']++;
                         break;
                     case 'N/A':
                         $countersInfo['EIRPNA']++;
                         break;
                 }
                 // switch
                 $countersInfo['EIRPTotal']++;
             }
         }
         // inner foreach
     }
     // if
     // printArray($countersInfo);
     return $countersInfo;
 }
 public function getRegulatoryBugs($build, $platform)
 {
     $con2 = regulatory_dbconnect();
     $regulatoryBugs = array();
     $sql_query = "select * from RegulatoryBugs where buildNum like '%{$build}%' and platform like '%{$platform}%' ";
     $result = mysql_query($sql_query);
     $num_rows = mysql_num_rows($result);
     while ($row = mysql_fetch_assoc($result)) {
         $bugs = explode(",", $row['bugs']);
         $regulatoryBugs[$build][$platform][$row['countryId']][$row['apId']] = array();
         array_push($regulatoryBugs[$build][$platform][$row['countryId']][$row['apId']], $bugs);
     }
     // while end
     regulatory_dbclose($con2);
     return $regulatoryBugs;
 }