Some preparation for CRON

This commit is contained in:
evrifaessa committed 2020-11-29 13:53:31 +03:00
1 parent 5365c1b3a8
commit 4c850759ce
2 files changed
+15 -1

No files matched your search

+1 -1
View File
@@ -166,7 +166,7 @@ class Admin extends \Api_Abstract
}
/**
* Automatically update all currency rates by Google exchange rates
* Automatically update all currency rates.
*
* @return bool
*/
+14
View File
@@ -499,4 +499,18 @@ class Service implements InjectionAwareInterface
return true;
}
public static function onBeforeAdminCronRun(\Box_Event $event)
{
$di = $event->getDi();
$currencyService = $di['mod_service']('currency');
try {
$currencyService->updateCurrencyRates();
} catch (\Exception $e) {
error_log($e);
}
return true;
}
}