Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin/compatibility_report.php
diff options
context:
space:
mode:
Diffstat (limited to 'bin/compatibility_report.php')
-rw-r--r--bin/compatibility_report.php168
1 files changed, 90 insertions, 78 deletions
diff --git a/bin/compatibility_report.php b/bin/compatibility_report.php
index 1ad2ceb..567139e 100644
--- a/bin/compatibility_report.php
+++ b/bin/compatibility_report.php
@@ -52,39 +52,6 @@ class Object {}
$db = new Database();
$versioncompare = new VersioncompareComponent();
-global $compatibility_versions;
-
-$appversions = array();
-$totals = array();
-
-foreach ($compatibility_versions as $compatibility_version) {
- $totals[$compatibility_version] = array(
- COMPAT_LATEST => array(
- 'count' => 0,
- 'adu' => 0
- ),
- COMPAT_BETA => array(
- 'count' => 0,
- 'adu' => 0
- ),
- COMPAT_ALPHA => array(
- 'count' => 0,
- 'adu' => 0
- ),
- COMPAT_OTHER => array(
- 'count' => 0,
- 'adu' => 0
- )
- );
-
- $versions_qry = $db->query("SELECT id, version FROM appversions WHERE application_id = ".APP_FIREFOX." AND version LIKE '{$compatibility_version}%'");
- while ($version = mysql_fetch_assoc($versions_qry)) {
- $versions[$compatibility_version][$version['id']] = $version['version'];
- }
-
- $appversions[$compatibility_version] = $versioncompare->getCompatibilityGrades($compatibility_version, $versions[$compatibility_version]);
-}
-
// Get latest update pings date
$date_qry = $db->query("SELECT date FROM update_counts ORDER BY date DESC LIMIT 1");
$date_array = mysql_fetch_assoc($date_qry);
@@ -112,71 +79,116 @@ $addon_qry = $db->query("
translations.locale = 'en-US' AND
versions.id = (
SELECT id FROM versions WHERE addon_id = addons.id ORDER BY created DESC LIMIT 1
- ) AND
- addons.id NOT IN (1269,2390,10,4938)
+ )
GROUP BY
addons.id
ORDER BY
update_counts.count DESC
");
-$adu_total = 0;
$all_addons = array();
-$addons = array();
// Sum all update pings to establish total active users
while ($addon = mysql_fetch_assoc($addon_qry)) {
- $adu_total += $addon['updatepings'];
$all_addons[] = $addon;
}
-// Calculate 95%
-$adu_top95 = floor($adu_total * .95);
-$adu_counter = 0;
+// set in site/app/config/config.php
+global $compatibility_versions;
-// Iterate through each add-on
-foreach ($all_addons as $addon) {
- // Only include add-ons that make up the top 95%
- if ($adu_counter >= $adu_top95) break;
-
- $classification = array();
-
- foreach ($compatibility_versions as $compatibility_version) {
- $classification[$compatibility_version] = $versioncompare->gradeCompatibility($addon['maxversion'], $compatibility_version, $appversions[$compatibility_version]);
+// Previous version defaults to 2.0 because 3.0 is the first compat version we have available
+$previous_version = '2.0';
- $totals[$compatibility_version][$classification[$compatibility_version]]['count']++;
- $totals[$compatibility_version][$classification[$compatibility_version]]['adu'] += $addon['updatepings'];
+/**
+ * iterate through each major compatibility version and make an individual
+ * report based on above general info
+ */
+foreach ($compatibility_versions as $compatibility_version) {
+ $compat_addons = array();
+ $adu_total = 0;
+ foreach ($all_addons as $addon) {
+ // Only count this add-on if it is compatible with the major/minor release before
+ if (!empty($previous_version) && $versioncompare->compareVersions($addon['maxversion'], $previous_version) < 0) continue;
+
+ $compat_addons[] = $addon;
+ $adu_total += $addon['updatepings'];
}
- $addons[] = array(
- 'id' => $addon['id'],
- 'name' => $addon['name'],
- 'maxversion' => $addon['maxversion'],
- 'featured' => $addon['featured'],
- 'percentage' => ($addon['updatepings'] / $adu_top95),
- 'classification' => $classification
+ $adu_top95 = floor($adu_total * .95);
+
+ $totals = array(
+ COMPAT_LATEST => array(
+ 'count' => 0,
+ 'adu' => 0
+ ),
+ COMPAT_BETA => array(
+ 'count' => 0,
+ 'adu' => 0
+ ),
+ COMPAT_ALPHA => array(
+ 'count' => 0,
+ 'adu' => 0
+ ),
+ COMPAT_OTHER => array(
+ 'count' => 0,
+ 'adu' => 0
+ )
);
- //echo "{$addon['name']} - {$addon['maxversion']} - {$classification['3.1']} - {$adu_counter}<br>";
-
- $adu_counter += $addon['updatepings'];
-}
-
-$totals['adu95'] = $adu_top95;
-$totals['adu'] = $adu_total;
-$totals['addons95'] = count($addons);
-$totals['addons'] = mysql_num_rows($addon_qry);
+ $versions_qry = $db->query("SELECT id, version FROM appversions WHERE application_id = ".APP_FIREFOX." AND version LIKE '{$compatibility_version}%'");
+ $versions = array();
+ while ($version = mysql_fetch_assoc($versions_qry)) {
+ $versions[$version['id']] = $version['version'];
+ }
+
+ $appversions = $versioncompare->getCompatibilityGrades($compatibility_version, $versions);
+
+
+ $adu_counter = 0;
+ $addons = array();
+
+ // Iterate through each add-on
+ foreach ($compat_addons as $addon) {
+ // Only include add-ons that make up the top 95%
+ if ($adu_counter >= $adu_top95) break;
+
+ $classification = $versioncompare->gradeCompatibility($addon['maxversion'], $compatibility_version, $appversions);
+
+ $totals[$classification]['count']++;
+ $totals[$classification]['adu'] += $addon['updatepings'];
+
+ $addons[] = array(
+ 'id' => $addon['id'],
+ 'name' => $addon['name'],
+ 'maxversion' => $addon['maxversion'],
+ 'featured' => $addon['featured'],
+ 'percentage' => ($addon['updatepings'] / $adu_top95),
+ 'classification' => $classification
+ );
+
+ $adu_counter += $addon['updatepings'];
+ }
+
+ $totals['adu95'] = $adu_top95;
+ $totals['adu'] = $adu_total;
+ $totals['addons95'] = count($addons);
+ $totals['addons'] = mysql_num_rows($addon_qry);
+
+ echo "<br /><hr />Report for Firefox {$compatibility_version}<br />";
+ echo "Using data from {$latest_date}<br />";
+ echo "{$totals['adu']} total active users; {$totals['adu95']} making up top 95%<br />";
+ echo "{$totals['addons']} rows returned; {$totals['addons95']} addons counted<br /><br />";
+
+ $output = array(
+ 'addons' => $addons,
+ 'totals' => $totals,
+ 'appversions' => $appversions
+ );
-echo "{$latest_date}<br />";
-echo "{$totals['adu']} total active users; {$totals['adu95']} making up top 95%<br />";
-echo "{$totals['addons']} rows returned; {$totals['addons95']} addons counted<br /><br />";
+ echo '<pre>'.print_r($output, true).'</pre>';
-$output = array(
- 'addons' => $addons,
- 'totals' => $totals,
- 'appversions' => $appversions
-);
+ file_put_contents(NETAPP_STORAGE.'/compatibility-fx-'.$compatibility_version.'.serialized', serialize($output));
-echo '<pre>'.print_r($output, true).'</pre>';
+ $previous_version = $compatibility_version;
+}
-file_put_contents(NETAPP_STORAGE.'/compatibility.serialized', serialize($output));
?>