if ($r->isEmpty()) {
$search = self::searchGFXDevice($c->gpu, $rgpu, $version);
-
- $doc = new DOMDocument();
- $doc->strictErrorChecking = FALSE;
- $doc->loadHTML($search['body']);
- $xml = simplexml_import_dom($doc);
-
- $links = $xml->xpath("//a");
- if(null===$xml){
-
- }
- foreach ($links as $link) {
- $h = parse_url($link['href']);
- if (trim($h['path']) != 'subtest_results_of_device.jsp') {
- continue;
- }
- parse_str($h['query'], $data);
- if (!isset($data['id'])) {
- continue;
- }
- $values = $link->xpath('span[@class=\'value\']');
- if (!count($values)) {
- continue;
- }
- $value = trim((string)$values[0]);
- if ($value == 'N/A') {
- continue;
+ if ($search['body'] === '') {
+ $res = '';
+ $score = -1;
+ } else {
+ $doc = new DOMDocument();
+ $doc->strictErrorChecking = FALSE;
+ $doc->loadHTML($search['body']);
+ $xml = simplexml_import_dom($doc);
+ if (null === $xml) {
+ return -1;
}
- if (!stristr($value, 'frame')) {
- continue;
+ $links = $xml->xpath("//a");
+
+ foreach ($links as $link) {
+ $h = parse_url($link['href']);
+ if (!isset($h['path']) || trim($h['path']) !== 'subtest_results_of_device.jsp') {
+ continue;
+ }
+ parse_str($h['query'], $data);
+ if (!isset($data['id'])) {
+ continue;
+ }
+ $values = $link->xpath('span[@class=\'value\']');
+ if (!count($values)) {
+ continue;
+ }
+ $value = trim((string)$values[0]);
+ if ($value == 'N/A') {
+ continue;
+ }
+ if (!stristr($value, 'frame')) {
+ continue;
+ }
+ $res[$data['id']] = intval($value);
}
- $res[$data['id']] = intval($value);
- }
- $scoreids = self::gpuTests();
- $num = 0;
- $score = 0;
- foreach ($scoreids as $scoreid) {
- if (!isset($res[$scoreid])) {
- continue;
+ $scoreids = self::gpuTests();
+ $num = 0;
+ $score = 0;
+ foreach ($scoreids as $scoreid) {
+ if (!isset($res[$scoreid])) {
+ continue;
+ }
+ $num++;
+ $score += $res[$scoreid];
}
- $num++;
- $score += $res[$scoreid];
- }
- $score /= $num;
- $score = round($score);
+ $score /= $num;
+ $score = round($score);
+ }
$c = $core->con->openCursor('gpu');
$c->gpu = $gpu;