$locale = $_GET['locale']; } // Get lang files status from langchecker $json_data = new Json(); $lang_files = $json_data->setURI(LANG_CHECKER . "?locale={$locale}&json")->fetchContent(); // Check if the locale is working on locamotion $cache_id = 'locamotion_locales'; if (!($locamotion = Cache::getKey($cache_id))) { $locamotion = $json_data->setURI(LANG_CHECKER . '?action=listlocales&project=locamotion&json')->fetchContent(); Cache::setKey($cache_id, $locamotion); } $locamotion = in_array($locale, $locamotion); // All open bugs for a locale in the mozilla.org/l10n component $bugzilla_query_mozillaorg = 'https://bugzilla.mozilla.org/buglist.cgi?' . 'f1=cf_locale' . '&o1=equals' . '&query_format=advanced' . '&v1=' . urlencode(Bugzilla::getBugzillaLocaleField($locale)) . '&o2=equals' . '&f2=component' . '&v2=L10N' . '&bug_status=UNCONFIRMED' . '&bug_status=NEW' . '&bug_status=ASSIGNED' . '&bug_status=REOPENED' . '&classification=Other' . '&product=www.mozilla.org'; // All open bugs for a locale in the Mozilla Localization/locale component, with "webdashboard" in the whiteboard $bugzilla_query_l10ncomponent = 'https://bugzilla.mozilla.org/buglist.cgi?' . '&query_format=advanced' . '&status_whiteboard_type=allwordssubstr' . '&status_whiteboard=webdashboard' . '&bug_status=UNCONFIRMED' . '&bug_status=NEW' . '&bug_status=ASSIGNED' . '&bug_status=REOPENED' . '&component=' . urlencode(Bugzilla::getBugzillaLocaleField($locale, 'l10n')) . '&classification=Client%20Software' . '&product=Mozilla%20Localizations'; /* Use cached requests if available, cache expires after 1 hour * Note: result can be empty, so I need to check strictly for false */ $cache_id = "bugs_mozillaorg_{$locale}"; $bugs_mozillaorg = Cache::getKey($cache_id, 60 * 60); if ($bugs_mozillaorg === false) { $csv_mozillaorg = file($bugzilla_query_mozillaorg . '&ctype=csv'); $bugs_mozillaorg = Bugzilla::getBugsFromCSV($csv_mozillaorg); Cache::setKey($cache_id, $bugs_mozillaorg); } $cache_id = "bugs_l10ncomponent_{$locale}"; $bugs_l10ncomponent = Cache::getKey($cache_id, 60 * 60); if ($bugs_l10ncomponent === false) { $csv_l10ncomponent = file($bugzilla_query_l10ncomponent . '&ctype=csv'); $bugs_l10ncomponent = Bugzilla::getBugsFromCSV($csv_l10ncomponent);
dashboard. */ namespace Webdashboard; use Bugzilla\Bugzilla; use Cache\Cache; require_once __DIR__ . '/../config/init.php'; // Include all data about our locales include __DIR__ . '/../data/locales.php'; $results = []; $results['types']["Webbugs"] = ["pluralLabel" => "Webbugs"]; $results['properties']["total_webbugs"] = ["valueType" => "number"]; $results['properties']["missing_webbugs"] = ["valueType" => "number"]; // All opened bugs for a locale in the mozilla.org/l10n component foreach ($locales as $locale) { $bugzilla_query = 'https://bugzilla.mozilla.org/buglist.cgi?' . 'f1=cf_locale' . '&o1=equals' . '&query_format=advanced' . '&v1=' . urlencode(Bugzilla::getBugzillaLocaleField($locale)) . '&o2=equals' . '&f2=component' . '&v2=L10N' . '&bug_status=UNCONFIRMED' . '&bug_status=NEW' . '&bug_status=ASSIGNED' . '&bug_status=REOPENED' . '&classification=Other' . '&product=www.mozilla.org'; /* Check if there is a cached request for this element. * For this request I use a ttl of 6 hours instead of default (15 minutes), * since it requires a lot of time. */ $cache_id = "bugs_mozillaorg_{$locale}"; $bugs = Cache::getKey($cache_id, 6 * 60 * 60); if ($bugs === false) { $csv = file($bugzilla_query . '&ctype=csv'); $bugs = Bugzilla::getBugsFromCSV($csv); Cache::setKey($cache_id, $bugs); } // Generate all the bugs $results['items'][] = ["type" => "Webbugs", "label" => $locale, "missing_webbugs" => count($bugs), "total_webbugs" => count($bugs)]; } $json_data = new Json();