diff --git a/get-oldsummarydata.php b/get-oldsummarydata.php new file mode 100644 index 0000000..6ed0a05 --- /dev/null +++ b/get-oldsummarydata.php @@ -0,0 +1,149 @@ +#!/usr/bin/php + $min_builddate && (!$is_hang || $ptype == 'plugin')) { + $type = ucfirst($ptype); + // Create a type that matches what Socorro has internally nowadays. + if ($ptype == 'plugin') { $type = ($is_hang?'Hang ':'OOP ').$type; } + // Add info to array. + if (!array_key_exists('crashes', $prodtypedata[$anaday])) { + $prodtypedata[$anaday]['crashes'] = array(); + } + if (!array_key_exists($type, $prodtypedata[$anaday]['crashes'])) { + $prodtypedata[$anaday]['crashes'][$type] = $count; + } + else { + $prodtypedata[$anaday]['crashes'][$type] += $count; + } + if (!array_key_exists('versions', $prodtypedata[$anaday])) { + $prodtypedata[$anaday]['versions'] = array($version); + } + elseif (!in_array($version, $prodtypedata[$anaday]['versions'])) { + $prodtypedata[$anaday]['versions'][] = $version; + } + } + } + } + } + } + file_put_contents($fprodtypedata, json_encode($prodtypedata)); +} + +// *** helper functions *** + + +?> diff --git a/get-socorrodata.php b/get-socorrodata.php index 513c62a..4b6c75f 100755 --- a/get-socorrodata.php +++ b/get-socorrodata.php @@ -191,7 +191,8 @@ foreach ($prodchannels as $product=>$channels) { $max_build_age = ($channel == 'Release')?'9 weeks':'3 weeks'; $db_query = 'SELECT crashes_by_user.report_date, crash_types.crash_type, ' - .'SUM(crashes_by_user.report_count) AS crashes, SUM(crashes_by_user.adu) AS adi ' + .'SUM(crashes_by_user.report_count) AS crashes, SUM(crashes_by_user.adu) AS adi, ' + ."string_agg(product_versions.version_string,',') as versions " .'FROM crashes_by_user JOIN product_versions' .' ON (crashes_by_user.product_version_id=product_versions.product_version_id)' .' JOIN crash_types ON (crashes_by_user.crash_type_id=crash_types.crash_type_id) ' @@ -213,6 +214,7 @@ foreach ($prodchannels as $product=>$channels) { $type = $row['crash_type']; $crashes = intval($row['crashes']) * (($product == 'Firefox' && $channel == 'Release') ? 10 : 1); $adi = intval($row['adi']); + $versions = array_unique(explode($row['versions'])); if ($crashes || $adi) { $prodtypedata[$day]['adi'] = $adi; if (!array_key_exists('crashes', $prodtypedata[$day])) {