public static function callback($object, $method, $args = array(), $cache_lifetime = null, $overrideConfig = false) { $conf = JFactory::getConfig(); $cacheactive = $conf->get('config.caching'); $cachetime = $conf->get('config.cachetime'); $cache = JFactory::getCache(static::CACHE_GROUP, 'callback'); $key_error = false; $response = OstoolbarRequest::makeRequest(array('resource' => 'checkapi')); if ($response->hasError() || $response->getBody() == 0) { $key_error = true; $cache = JFactory::getCache(static::CACHE_GROUP . "_trial", 'callback'); OstoolbarRequest::$isTrial = true; } if ($overrideConfig) { $cache->setCaching(1); //enable caching } if ($cache_lifetime) { $cache->setLifeTime($cache_lifetime); } $data = static::getCache($object, $method, $args, $cache); if ($data !== false) { // In this case we have data in cache but just send minimum request to check update $response = OstoolbarRequest::makeRequest(array('resource' => 'lastupdate')); if (!$response->hasError()) { $last_update = strtotime($response->getBody()); if (is_array($data)) { if (count($data) && strtotime($data[0]->last_update_date) < $last_update || count($data) == 0) { $cache->clean(); $data = static::getCache($object, $method, $args, $cache); } } } } if (get_class($object) == "OSToolbarModelTutorial" && !empty($data)) { $data->jversion = $key_error ? "1.6_trial" : "1.6"; } if ($overrideConfig) { $cache->setCaching($cacheactive); } if ($cache_lifetime) { $cache->setLifeTime($cachetime); } return $data; }