$db->bourbon_suggestions->suggestion('text', 0, false);\r
$db->bourbon_suggestions->page('varchar', 256, false);\r
\r
+ // Table gpu\r
+ $db->gpu->gpu('varchar', 256, false);\r
+ $db->gpu->page('text', 0, false);\r
+ $db->gpu->version('integer', 0, false);\r
+ $db->gpu->date('integer', 0, false);\r
+ $db->gpu->score('integer', 0, false);\r
+ $db->gpu->benchmark('text', 0, false);\r
+ $db->gpu->primary('pk_gpu', 'gpu', 'version');\r
+\r
try {\r
$dbi = new CubeDbStruct($this->con);\r
$dbi->synchronize($db);\r
$api->subscribe('33699982ca', $data);
}
+
+ public static function gpuSeparators()
+ {
+ return ['Direct3D', 'DirectX', 'OpenGL', 'Graphics'];
+ }
+
+ public function gup()
+ {
+ global $core;
+
+ $this->outputXML = false;
+
+ $gpu = base64_decode($_GET['gup']);
+ if (preg_match('/\(([^\)]*)\)/', $gpu, $matches)) {
+ $gpu = $matches[1];
+ }
+ $version = 40;
+
+ $split = self::gpuSeparators();
+
+ foreach ($split as $item) {
+ $e = explode($item, $gpu);
+ if (count($e) > 1) {
+ $gpu = $e[0];
+ break;
+ }
+ }
+
+ $gpu = trim($gpu);
+
+ $r = $core->con->select("SELECT * FROM gpu WHERE version=" . $version . " AND gpu='" . $core->con->escape($gpu) . "'");
+ header('Content-type: text/plain');
+ if ($r->isEmpty()) {
+ $ugpu = urlencode($gpu);
+ $url = 'https://gfxbench.com/device.jsp?benchmark=gfx' . $version . '&api=gl&hwtype=dGPU&os=Linux&hwname=' . $ugpu . '&D=' . $ugpu . '&testgroup=graphics&var=median';
+
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_VERBOSE, 1);
+ curl_setopt($ch, CURLOPT_HEADER, 1);
+ curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0');
+ $response = curl_exec($ch);
+ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
+ $f = substr($response, $header_size);
+
+ $doc = new DOMDocument();
+ $doc->strictErrorChecking = FALSE;
+ $doc->loadHTML($f);
+ $xml = simplexml_import_dom($doc);
+
+ $links = $xml->xpath("//a");
+ 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 (!stristr($value, 'frame')) {
+ continue;
+ }
+ $res[$data['id']] = intval($value);
+ }
+
+ $scoreids = [680, 544, 632, 546];
+ $num = 0;
+ $score = 0;
+ foreach ($scoreids as $scoreid) {
+ if (!isset($res[$scoreid])) {
+ continue;
+ }
+ $num++;
+ $score += $res[$scoreid];
+ }
+
+ $score /= $num;
+ $score = round($score);
+
+ $c = $core->con->openCursor('gpu');
+ $c->gpu = $gpu;
+ $c->page = $f;
+ $c->version = $version;
+ $c->benchmark = serialize($res);
+ $c->score = $score;
+ $c->date = time();
+ $c->insert();
+
+ echo $score;
+ } else {
+ $r->fetch();
+ echo $r->score;
+ }
+ exit;
+ }
}
$this->config->manifest = $this->writeManifest();
}
+ $this->writeGPUDatabase();
+
if ($this->config->form == 'bulle') {
$this->addJsLib('bulle', 'js/libs/fluidbook/forms/fluidbook.form.bulle.js');
} else if ($this->config->form == 'bourbon') {
$this->config->seoArticles = $this->seoArticles;
}
+ public function writeGPUDatabase()
+ {
+ global $core;
+ $r = $core->con->select('SELECT gpu,score FROM gpu');
+ $gpu = [];
+ while ($r->fetch()) {
+ $gpu[$r->gpu] = $r->score;
+ }
+ $this->config->gupsc = $gpu;
+ $this->config->gupse = wsServices::gpuSeparators();
+ }
+
public function log($step)
{
$currenttime = microtime(true);
$svg = '';
foreach ($svgfiles as $svgfile) {
if (file_exists($svgfile)) {
- $svg .= str_replace('$bookmark-color',wsHTML5::colorToCSS($this->theme->parametres->bookmarkBackgroundColor),file_get_contents($svgfile));
+ $svg .= str_replace('$bookmark-color', wsHTML5::colorToCSS($this->theme->parametres->bookmarkBackgroundColor), file_get_contents($svgfile));
} else {
die($svgfile . ' does not exist');
}