Branch: Tag:

2001-08-14

2001-08-14 18:40:46 by Johan Schön <js@opera.com>

Bugfix to the previous bugfix: Set stage to 0 if the added uri already exists, and it's stage is not 5 or 6

Rev: lib/modules/Search.pmod/Queue.pmod/MySQL.pike:1.5

77:    rpath=rpath[sizeof(index)..];    r->path=reverse(rpath);    -  if( (force || (check_link(uri, allow, deny))) && !has_uri( r ) ) +  if( force || check_link(uri, allow, deny) )    { -  mixed err = catch( +  if(has_uri(r)) +  { +  int stage = get_stage(r); +  if(stage!=5 && stage!=6) +  set_stage(r, 0); +  } +  else    db->query( "insert into "+table+    " (uri,uri_md5,recurse,template) values (%s,%s,%d,%s)",    string_to_utf8((string)r),    to_md5((string)r), recurse, (template||"") ) ); -  if(err) -  { -  werror("Error inserting %s into queue.\n", (string)r); -  werror("hascache: %O\n", hascache); -  throw(err); +     }   } - } +       void set_md5( Standards.URI uri, string md5 )   {
228:    db->query( "update "+table+" set stage=%d where uri_md5=%s",stage,    to_md5((string)uri));   } +  + int get_state( Standards.URI uri ) + { +  array a = db->query( "select state from "+table+" where uri_md5=%s", to_md5((string)uri)); +  if(sizeof(a)) +  return (int)a[0]->state; +  else +  return -1; + }