Roxen.git / server / modules / tags / insert_cached_href.pike

version» Context lines:

Roxen.git/server/modules/tags/insert_cached_href.pike:1:   // This is a roxen module. Copyright © 2000 - 2004, Roxen IS.   //      #include <module.h>   inherit "module";      //<locale-token project="mod_insert_cached_href">LOCALE</locale-token>   #define LOCALE(X,Y) _DEF_LOCALE("mod_insert_cached_href",X,Y)    - constant cvs_version = "$Id: insert_cached_href.pike,v 1.12 2006/06/01 13:58:42 jonasw Exp $"; + constant cvs_version = "$Id: insert_cached_href.pike,v 1.13 2006/06/01 13:59:44 jonasw Exp $";      constant thread_safe = 1;   constant module_type = MODULE_TAG;   LocaleString module_name = LOCALE(0, "Tags: Insert cached href");   LocaleString module_doc = LOCALE(0, "This module contains the RXML tag \"insert "    "cached-href\". Useful when implementing e.g."    " RSS syndication.");      #if DEBUG_INSERT_CACHED_HREF   #define DWRITE(x) report_debug("INSERT_CACHED_HREF: " + x + "\n")
Roxen.git/server/modules/tags/insert_cached_href.pike:74:    if (occasion == 0) {    href_database = HrefDatabase();   #ifdef THREADS    initiated = ({});    mutex = Thread.Mutex();   #endif    }      #ifdef THREADS    if (occasion == 2) -  bg_process->stop(); +  bg_process && bg_process->stop();       // Check whether setup is ok before scheduling background task    if (href_database) { -  if (href_database->ready_to_run()) +  if (href_database->ready_to_run()) {    bg_process =    roxen.BackgroundProcess(get_time_in_seconds(query("update-interval")),    href_database->update_db, 0); -  else +  } else {    report_error("Insert cached href: Failed to initialize SQL tables. "    "Permission error?\n");    } -  +  }   #endif   }      void stop() {    DWRITE("stop()");      #ifdef THREADS -  bg_process->stop(); +  bg_process && bg_process->stop();    bg_process = 0;    mutex_key = mutex->lock();       /* Removing registered callbacks for unfinished data fetches to avoid having the    back-end thread call them after the module has been destructed: */    foreach(initiated, HTTPClient client) {    client->con->request_ok = 0;    client->con->request_fail = 0;    }   
Roxen.git/server/modules/tags/insert_cached_href.pike:522:    constant name = "insert";    constant plugin_name = "cached-href";       string get_data(string var, mapping args, RequestID id) {    int recursion_depth = (int)id->request_headers["x-roxen-recursion-depth"];       if (query("recursion_limit") &&    (recursion_depth >= query("recursion_limit")))    RXML.run_error("Too deep insert cached-href recursion.");    +  // Verify that database connection is working +  if (!href_database || !href_database->ready_to_run()) +  RXML.run_error("Insert cached href: Database connection not working. " +  "Permission problems?\n"); +     recursion_depth++;       if(args->nocache)    NOCACHE();    else    CACHE(60);       string res = href_database->get_data(Attributes(args)->get_db_args(),    (["x-roxen-recursion-depth":recursion_depth]));