7
static function getTimeline($id, $type, $release) {
8
$db = Factory::Database();
12
$result = $db->query("
14
v.platform, IFNULL(v.version,'') AS version, v.nickname, v.releasedate, v.status, f.score, f.results
17
LEFT JOIN data_versions AS v ON (p.platform = v.platform)
18
LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
19
LEFT JOIN fingerprints AS f ON (s.fingerprint = f.fingerprint)
21
(p.platform = '" . $db->escape_string($id) . "' OR p.related = '" . $db->escape_string($id) . "') AND
22
FIND_IN_SET('" . $db->escape_string($type) . "',p.type) AND
23
FIND_IN_SET('" . $db->escape_string($type) . "',v.type) AND
24
v.status != 'experimental' AND
25
s.release = '" . $release . "'
27
IF(v.status='upcoming',1,0) DESC, v.releasedate DESC, p.related, v.version DESC
30
while ($row = $result->fetch_object()) {
34
for ($i = 0; $i < count($results) - 1; $i++) {
35
$results[$i]->changes = Results::getDiff($results[$i]->results, $results[$i + 1]->results);
38
for ($i = 0; $i < count($results); $i++) {
39
unset($results[$i]->results);
45
static function getArray($string) {
48
$array = explode(',', $string);
50
for ($i = 0; $i < count($array); $i++) {
51
$item = explode('=', $array[$i]);
52
$result[$item[0]] = $item[1];
58
static function getDiff($current, $previous) {
59
$current = Results::getArray($current);
60
$previous = Results::getArray($previous);
64
foreach ($previous AS $p => $value) {
65
if (preg_match("/\.codecs\./", $p)) continue;
67
if ($previous[$p] == 33) $previous[$p] = 1;
68
if ($current[$p] == 33) $current[$p] = 1;
70
if ($previous[$p] != $current[$p]) {
71
$changes[] = (object) array(
73
'from' => $previous[$p],
83
static function getByFeature($id, $release) {
84
$db = Factory::Database();
88
$result = $db->query("
90
IFNULL(SUBSTRING_INDEX(SUBSTRING_INDEX(f.results,'" . $db->escape_string($id) . "=',-1),',',1),0) as supported,
91
v.platform, IFNULL(v.version,'') AS version
94
LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
95
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
97
s.release = '" . $release . "'
100
while ($row = $result->fetch_object()) {
101
$results[] = $row->platform . '-' . $row->version . '=' . $row->supported;
107
static function getByBrowser($browser, $release) {
108
$db = Factory::Database();
110
$browser = explode('-', $browser);
112
if (count($browser) > 1) {
113
list($browserPlatform, $browserVersion) = $browser;
115
$result = $db->query("
117
v.platform, IFNULL(v.version,'') AS version, v.nickname, f.score, f.points, f.results
120
LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
121
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
123
s.release = '" . $release . "' AND
124
v.platform = '" . $db->escape_string($browserPlatform) . "' AND
125
v.version = '" . $db->escape_string($browserVersion) . "'
128
if ($row = $result->fetch_object()) {
135
$browserPlatform = $browser[0];
138
$result = $db->query("
140
v.platform, IFNULL(v.version,'') AS version, v.nickname, f.score, f.points, f.results
143
LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
144
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
146
s.release = '" . $release . "' AND
147
v.platform = '" . $db->escape_string($browserPlatform) . "' AND
153
if ($row = $result->fetch_object()) {
160
static function getByUniqueId($id) {
161
$db = Factory::Database();
163
$result = $db->query("
165
r.release, r.uniqueid AS id, 'Unique id' AS nickname, f.score, f.maximum, f.points, f.results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight, f.fingerprint
168
LEFT JOIN fingerprints AS f ON (r.fingerprint = f.fingerprint)
170
r.uniqueid ='" . $db->escape_string($id) . "'
173
if ($row = $result->fetch_object()) {
175
// Update use counter
183
uniqueid = "' . $db->escape_string($id) . '"
190
/* Quick hack to make older ids work again */
192
$result = $db->query("
194
r.version as `release`, r.uniqueid AS id, 'Unique id' AS nickname, f.score, f.maximum, f.points, f.results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight, f.fingerprint
196
html5test5.results AS r
197
LEFT JOIN html5test5.fingerprints AS f ON (r.fingerprint = f.fingerprint)
199
r.uniqueid ='" . $db->escape_string($id) . "'
202
if ($row = $result->fetch_object()) {
204
// Update use counter
212
uniqueid = "' . $db->escape_string($id) . '"
220
static function getByFingerprint($id) {
221
$db = Factory::Database();
225
score, maximum, points, results
229
fingerprint ='" . $db->escape_string($id) . "'
232
if ($row = $res->fetch_object()) {
238
static function export($release) {
239
$db = Factory::Database();
254
while ($row = $res->fetch_object()) {
255
$browser = (object) array(
256
'name' => $row->name,
257
'kind' => $row->kind,
258
'versions' => array()
267
platform = '" . addslashes($row->id) . "'
272
while ($vrow = $vres->fetch_object()) {
273
$version = (object) array(
274
'id' => is_null($vrow->version) ? $vrow->platform : $vrow->platform . '-' . $vrow->version,
275
'version' => $vrow->version,
276
'nickname' => $vrow->nickname,
277
'release' => $vrow->release
280
$browser->versions[] = $version;
283
$browsers[] = $browser;
291
v.platform, IFNULL(v.version,'') AS version, f.results
294
LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL)))
295
LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint)
297
s.release = '" . $release . "'
299
v.platform, v.version
302
while ($row = $res->fetch_object()) {
303
$r = explode(',', $row->results);
305
for ($i = 0; $i < count($r); $i++) {
306
list($key, $value) = explode('=', $r[$i]);
308
if (!isset($results[$key])) {
309
$results[$key] = array();
312
$platform = $row->version == '' ? $row->platform : $row->platform . '-' . $row->version;
313
$value = intval($value);
317
case !! ($value & 2): $results[$key][$platform] = 'yes:old';
318
case !! ($value & 4): $results[$key][$platform] = 'yes:buggy';
319
case !! ($value & 8): $results[$key][$platform] = 'yes:prefix';
320
default: $results[$key][$platform] = 'yes';
325
case !! ($value & 16): $results[$key][$platform] = 'no:blocked';
326
default: $results[$key][$platform] = 'no';
334
'browsers' => $browsers,
335
'results' => $results
b'\\ No newline at end of file'