/** * * Check the SDK status * @param $force. TRUE to check, no matter how soon the previous check was. This can have a great impact on the experience of the admin * */ protected function checkSDKStatus($force = false) { //call the API at most only once every 5 minutes, not sooner if (!$force && time() - $this->getConfigValue('api_last_check') < 5 * 60) { return; } //set the latest check time $this->setConfigValue('api_last_check', time()); //get an update from the API $message = ''; if (is_array($result = $this->getSDKStatus($this->getSecretKey(), $this->getClientId(), $this->getAppKey(), $message))) { //save the data $this->setConfigValue('api_version', @$result['api_version']); $this->setConfigValue('latest_version', @$result['plugin_latest_version']); $this->setConfigValue('download_url', @$result['plugin_download_url']); //set the current language the SDK should be displayed in if (isset($result['lang'])) { $this->setConfigValue('lang', $result['lang']); SyC::setLanguage($result['lang']); } } else { //simply log the error, for now! error_log(print_r($message, true)); } }
/** * * Check the SDK status * @param $force. TRUE to check, no matter how soon the previous check was. This can have a great impact on the experience of the admin * */ public function checkSDKStatus($force = false) { //call the API at most only once every 5 minutes, not sooner if (!$force && time() - $this->getConfigValue('api_last_check') < 5 * 60) { return; } //set the latest check time $this->setConfigValue('api_last_check', time()); //get an update from the API $message = ''; if (is_array($result = $this->getSDKStatus($this->getSecretKey(), $this->getClientId(), $this->getAppKey(), $message))) { //save the data $this->setConfigValue('api_version', @$result['api_version']); $this->setConfigValue('latest_version', @$result['plugin_latest_version']); $this->setConfigValue('download_url', @$result['plugin_download_url']); $this->setConfigValue('debug', @$result['debug']); //set the current language the SDK should be displayed in if (isset($result['lang'])) { $this->setConfigValue('lang', $result['lang']); SyC::setLanguage($result['lang']); //check if there is a new translation available for this language if (!empty($result['lang_checksum']) && $result['lang_checksum'] != SyC::getLanguageChecksum()) { //download the translation $messages = $this->getSDKTranslation(SyC::getLanguage()); //save the translation $this->setConfigValue('messages', $messages); //reset the loaded messages so that the new ones are being used SyC::reloadLanguage(); } } } else { //simply log the error, for now! error_log(print_r($message, true)); } }