Commit c805aaa8 authored by David Morley's avatar David Morley

no need to call an API hourly really

parent 1282f5f5
......@@ -36,12 +36,14 @@ $sqldebug && R::fancyDebug(true);
DetectLanguage::setApiKey(c('dlkey'));
$hour = date("H");
try {
// Setup GeoIP Database
$reader = new Reader(c('geoip2db'));
$sql = '
SELECT domain, score, date_created, weight, podmin_notify, email, masterversion, shortversion, status
SELECT domain, score, date_created, weight, podmin_notify, email, masterversion, shortversion, status, detectedlanguage
FROM pods
';
......@@ -74,6 +76,7 @@ foreach ($pods as $pod) {
$masterv = $pod['masterversion'];
$shortv = $pod['shortversion'];
$dbstatus = $pod['status'];
$language = $pod['detectedlanguage'];
try {
$ratings = R::getAll('
......@@ -266,8 +269,10 @@ foreach ($pods as $pod) {
}
}
if ($hs) {
if ($hs && $hour == 12) {
$detectedlanguage = DetectLanguage::simpleDetect($hs);
} elseif ($hs) {
$detectedlanguage = $language;
} else {
$score -= 1;
$detectedlanguage = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment