Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.1085 2011/12/22 09:54:04 wellhard Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.1086 2012/01/11 14:27:04 wellhard Exp $";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:4502:    if (!zero_type(timeout) && (timeout < time(1))) return; // Expired.    GET_DB();    array(mapping) rows =    QUERY("SELECT id, contents, timeout, "    "UNIX_TIMESTAMP() - UNIX_TIMESTAMP(atime) as atime_diff "    "FROM "+name+"2 "    "WHERE id = %s", id );       foreach( rows, mapping row )    if( row->contents != encoded_args ) { -  report_error("ArgCache.create_key(): " -  "Duplicate key found! Please report this to support@roxen.com: " -  "id: %O, old data: %O, new data: %O\n", +  report_error("ArgCache.create_key(): Duplicate key found! " +  "Please report this to support@roxen.com:\n" +  " id: %O\n" +  " old data: %O\n" +  " new data: %O\n" +  " Updating local database with new value.\n",    id, row->contents, encoded_args); -  error("ArgCache.create_key() Duplicate key found!\n"); +  +  // Remove the old entry (probably corrupt). No need to update +  // the database since the query below uses REPLACE INTO. +  rows = ({});    }       if(sizeof(rows)) {    // Update atime only if older than threshold.    if((int)rows[0]->atime_diff > ATIME_THRESHOLD) {    QUERY("UPDATE LOW_PRIORITY "+name+"2 "    " SET atime = NOW() "    " WHERE id = %s", id);    }   
Roxen.git/server/base_server/roxen.pike:4534:    } else if (timeout > (int)rows[0]->timeout) {    QUERY("UPDATE LOW_PRIORITY "+name+"2 "    " SET timeout = %d "    " WHERE id = %s", timeout, id);    }    }    return;    }       string timeout_sql = zero_type(timeout) ? "NULL" : (string)timeout; -  // Use REPLACE INTO to cope with entries created by other threads. +  // Use REPLACE INTO to cope with entries created by other threads +  // as well as corrupted entries that should be overwritten.    QUERY( "REPLACE INTO "+name+"2 "    "(id, contents, ctime, atime, timeout) VALUES "    "(%s, " MYSQL__BINARY "%s, NOW(), NOW(), "+timeout_sql+")",    id, encoded_args );       dwerror("ArgCache: Create new key %O\n", id);       (plugins->create_key-({0}))( id, encoded_args );    }