Exemple #1
0
// Trims the installed SWORD modules.
void sword_logic_trim_modules ()
{
#ifndef HAVE_CLIENT
  Database_Logs::log ("Trimming the installed SWORD modules");
  vector <string> modules = sword_logic_get_installed ();
  for (auto module : modules) {
    module = sword_logic_get_installed_module (module);
    string url = sword_logic_virtual_url (module, 0, 0, 0);
    if (!database_filebased_cache_exists (url)) {
      sword_logic_uninstall_module (module);
    }
  }
  Database_Logs::log ("Ready trimming the SWORD caches and modules");
#endif
}
Exemple #2
0
// In Cloud mode, this function wraps around http GET.
// It fetches existing content from the cache, and caches new content.
string resource_logic_web_cache_get (string url, string & error)
{
  // On the Cloud, check if the URL is in the cache.
  if (!config_logic_client_prepared ()) {
    if (database_filebased_cache_exists (url)) {
      return database_filebased_cache_get (url);
    }
  }
  // Fetch the URL from the network.
  // Do not cache the response in an error situation.
  error.clear ();
  string html = filter_url_http_get (url, error);
  if (!error.empty ()) {
    return html;
  }
  // In the Cloud, cache the response.
  if (!config_logic_client_prepared ()) {
    database_filebased_cache_put (url, html);
  }
  // Done.
  return html;
}