/** * @static * @return TranslationStatistic */ public static function getInstance() { if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; }
/** * Get information to build the language specific graph */ public function getGraphLang() { if (!AccountManager::getInstance()->isLogged()) { return JsonResponseBuilder::failure(); } $lang = AccountManager::getInstance()->vcsLang; $summary = RepositoryFetcher::getInstance()->getStaticValue('translation_summary', $lang); // If we don't have a summary, compute one and try again if ($summary === false) { TranslationStatistic::getInstance()->computeSummary($lang); $summary = RepositoryFetcher::getInstance()->getStaticValue('translation_summary', $lang); } $return = array(); if ($lang !== 'en') { $return[0]['id'] = $summary[0]->id; $return[0]['libel'] = $summary[0]->libel; $return[0]['total'] = $summary[0]->nbFiles; $return[1]['id'] = $summary[1]->id; $return[1]['libel'] = $summary[1]->libel; $return[1]['total'] = $summary[1]->nbFiles; $return[2]['id'] = $summary[2]->id; $return[2]['libel'] = $summary[2]->libel; $return[2]['total'] = $summary[2]->nbFiles; } return JsonResponseBuilder::success(array('nbItems' => count($return), 'Items' => $return)); }
// Write into the lock the update position $lock->writeIntoLock('checkErrors'); // Start checkErrors $rm->applyOnlyTools(); // Write into the lock the update position $lock->writeIntoLock('notInEN'); // Search for NotInEN Old Files $rm->updateNotInEN(); // Write into the lock the update position $lock->writeIntoLock('updateTranslatorInfo'); // Parse translators $rm->updateTranslatorInfo(); // Write into the lock the update position $lock->writeIntoLock('ComputeAllStatistics'); // Compute all summary TranslationStatistic::getInstance()->computeSummary('all'); TranslatorStatistic::getInstance()->computeSummary('all'); if ($project['code'] == 'php') { // Write into the lock the update position $lock->writeIntoLock('StaticRevcheck'); $rm->applyStaticRevcheck(); } // Store this update info $info = array(); $info['user'] = '******'; $rm->setStaticValue('info', 'updateData', json_encode($info), true); $lock->release(); } else { echo 'Update in progress, can\'t do this action until the first finish' . PHP_EOL; continue; }