| blib/lib/Search/Circa/Url.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| statement | 9 | 151 | 5.9 |
| branch | 0 | 86 | 0.0 |
| condition | 0 | 24 | 0.0 |
| subroutine | 3 | 16 | 18.7 |
| pod | 11 | 13 | 84.6 |
| total | 23 | 290 | 7.9 |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | package Search::Circa::Url; | ||||||
| 2 | |||||||
| 3 | # module Circa::Url : Manage url of Circa. See Search::Circa | ||||||
| 4 | # Copyright 2000 A.Barbet alian@alianwebserver.com. All rights reserved. | ||||||
| 5 | |||||||
| 6 | 12 | 12 | 7810 | use strict; | |||
| 12 | 25 | ||||||
| 12 | 452 | ||||||
| 7 | 12 | 12 | 2791 | use DBI; | |||
| 12 | 21152 | ||||||
| 12 | 1285 | ||||||
| 8 | 12 | 12 | 78 | use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); | |||
| 12 | 22 | ||||||
| 12 | 65758 | ||||||
| 9 | require Exporter; | ||||||
| 10 | |||||||
| 11 | @ISA = qw(Exporter); | ||||||
| 12 | @EXPORT = qw(); | ||||||
| 13 | $VERSION = ('$Revision: 1.19 $ ' =~ /(\d+\.\d+)/)[0]; | ||||||
| 14 | |||||||
| 15 | |||||||
| 16 | #------------------------------------------------------------------------------ | ||||||
| 17 | # new | ||||||
| 18 | #------------------------------------------------------------------------------ | ||||||
| 19 | sub new | ||||||
| 20 | { | ||||||
| 21 | 0 | 0 | 1 | my $class = shift; | |||
| 22 | 0 | my $self = {}; | |||||
| 23 | 0 | my $indexer = shift; | |||||
| 24 | 0 | bless $self, $class; | |||||
| 25 | 0 | $self->{DBH} = $indexer->{DBH}; | |||||
| 26 | 0 | $self->{INDEXER} = $indexer; | |||||
| 27 | 0 | return $self; | |||||
| 28 | } | ||||||
| 29 | |||||||
| 30 | #------------------------------------------------------------------------------ | ||||||
| 31 | # add | ||||||
| 32 | #------------------------------------------------------------------------------ | ||||||
| 33 | sub add { | ||||||
| 34 | 0 | 0 | 1 | my ($self,$idMan,%url)=@_; | |||
| 35 | 0 | my $id; | |||||
| 36 | 0 | 0 | $idMan=1 if (!$idMan); | ||||
| 37 | 0 | 0 | $url{niveau}=0 if (!$url{niveau}); | ||||
| 38 | 0 | 0 | $url{titre}=~s/([^\\])'/$1\\'/g if ($url{titre}); | ||||
| 39 | 0 | 0 | $url{description}=~s/([^\\])'/$1\\'/g if ($url{description}); | ||||
| 40 | 0 | 0 | chop ($url{url}) if ($url{url}=~/\/$/); | ||||
| 41 | 0 | my $requete = "insert into ".$self->{INDEXER}->pre_tbl.$idMan."links set "; | |||||
| 42 | 0 | 0 | $requete.= "url = '$url{url}'" if ($url{url}); | ||||
| 43 | 0 | 0 | $requete.= ",local_url = '$url{urllocal}'" if ($url{urllocal}); | ||||
| 44 | 0 | 0 | $requete.= ",titre = '$url{titre}'" if ($url{titre}); | ||||
| 45 | 0 | 0 | $requete.= ",description = '$url{description}'" if ($url{description}); | ||||
| 46 | 0 | 0 | $requete.= ",langue = '$url{langue}'" if ($url{langue}); | ||||
| 47 | 0 | 0 | $requete.= ",categorie = $url{categorie}" if ($url{categorie}); | ||||
| 48 | 0 | 0 | $requete.= ",parse = '$url{parse}'" if ($url{parse}); | ||||
| 49 | 0 | 0 | $requete.= ",valide = $url{valide}" if ($url{valide}); | ||||
| 50 | 0 | 0 | $requete.= ",niveau = $url{niveau}" if ($url{niveau}); | ||||
| 51 | 0 | 0 | $requete.= ",last_check = $url{last_check}" if ($url{last_check}); | ||||
| 52 | 0 | 0 | $requete.= ",last_update = '$url{last_update}'" if ($url{last_update}); | ||||
| 53 | 0 | 0 | $requete.= ",browse_categorie ='$url{browse_categorie}'" | ||||
| 54 | if ($url{browse_categorie}); | ||||||
| 55 | #print $requete," \n"; |
||||||
| 56 | 0 | $self->{INDEXER}->trace(4, $requete."\n"); | |||||
| 57 | 0 | my $sth = $self->{DBH}->prepare($requete); | |||||
| 58 | 0 | 0 | if ($sth->execute) { | ||||
| 59 | 0 | $sth->finish; | |||||
| 60 | 0 | $id = $sth->{'mysql_insertid'}; | |||||
| 61 | } | ||||||
| 62 | else { | ||||||
| 63 | 0 | $self->{INDEXER}->trace(2, "Circa::Url->add $requete $DBI::errstr\n"); | |||||
| 64 | 0 | return undef; | |||||
| 65 | } | ||||||
| 66 | 0 | return $id; | |||||
| 67 | } | ||||||
| 68 | |||||||
| 69 | #------------------------------------------------------------------------------ | ||||||
| 70 | # update | ||||||
| 71 | #------------------------------------------------------------------------------ | ||||||
| 72 | sub update { | ||||||
| 73 | 0 | 0 | 1 | my ($self,$compte,%url)=@_; | |||
| 74 | 0 | 0 | return undef unless ($url{id}); | ||||
| 75 | 0 | 0 | if ($url{titre}) { | ||||
| 76 | 0 | $url{titre}=~s/'/\\'/g; | |||||
| 77 | 0 | $url{titre}=~s/\\\\'/\\'/g; | |||||
| 78 | } | ||||||
| 79 | 0 | 0 | if ($url{description}) { | ||||
| 80 | 0 | $url{description}=~s/'/\\'/g; | |||||
| 81 | 0 | $url{description}=~s/\\\\'/\\'/g; | |||||
| 82 | } | ||||||
| 83 | 0 | my $requete = | |||||
| 84 | "update ".$self->{INDEXER}->pre_tbl.$compte."links set \n"; | ||||||
| 85 | # $requete.= "\n\turl = '$url{url}'," if ($url{url}); | ||||||
| 86 | 0 | 0 | $requete.= "\n\tlocal_url = '$url{urllocal}'," if ($url{urllocal}); | ||||
| 87 | 0 | 0 | $requete.= "\n\ttitre = '$url{titre}'," if ($url{titre}); | ||||
| 88 | 0 | 0 | $requete.= "\n\tdescription ='$url{description}'," | ||||
| 89 | if ($url{description}); | ||||||
| 90 | 0 | 0 | $requete.= "\n\tlangue = '$url{langue}'," if ($url{langue}); | ||||
| 91 | 0 | 0 | $requete.= "\n\tcategorie = $url{categorie}," if ($url{categorie}); | ||||
| 92 | 0 | 0 | $requete.= "\n\tparse = '$url{parse}'," if ($url{parse}); | ||||
| 93 | 0 | 0 | $requete.= "\n\tvalide = $url{valide}," if ($url{valide}); | ||||
| 94 | 0 | 0 | $requete.= "\n\tniveau = $url{niveau}," if ($url{niveau}); | ||||
| 95 | 0 | 0 | if ($url{last_check}) | ||||
| 96 | { | ||||||
| 97 | 0 | 0 | if ($url{last_check} eq 'NOW()') | ||||
| 0 | |||||||
| 98 | {$requete.= "\n\tlast_check = NOW(),";} | ||||||
| 99 | 0 | else { $requete.= "\n\tlast_check = '$url{last_check}',"; } | |||||
| 100 | } | ||||||
| 101 | 0 | 0 | $requete.= "\n\tlast_update = '$url{last_update}'," | ||||
| 102 | if ($url{last_update}); | ||||||
| 103 | 0 | 0 | $requete.= "\n\tbrowse_categorie ='$url{browse_categorie}'," | ||||
| 104 | if ($url{browse_categorie}); | ||||||
| 105 | 0 | 0 | if ($requete=~/,$/) { chop($requete); } | ||||
| 0 | |||||||
| 106 | 0 | $requete.=" where id=$url{id}"; | |||||
| 107 | # print $requete; | ||||||
| 108 | |||||||
| 109 | 0 | $self->{INDEXER}->trace(4, $requete."\n"); | |||||
| 110 | 0 | 0 | my $r = $self->{DBH}->do($requete) || return undef; | ||||
| 111 | # print "$requete $DBI::errstr\n" if (!$r or $r eq '0E0'); | ||||||
| 112 | 0 | 0 | 0 | return ((!$r or $r eq '0E0') ? 0 : 1); | |||
| 113 | } | ||||||
| 114 | |||||||
| 115 | #------------------------------------------------------------------------------ | ||||||
| 116 | # load | ||||||
| 117 | #------------------------------------------------------------------------------ | ||||||
| 118 | sub load { | ||||||
| 119 | 0 | 0 | 1 | my ($self,$compte,$id)=@_; | |||
| 120 | 0 | my @l = $self->{INDEXER}->fetch_first | |||||
| 121 | ("select url,local_url,titre,description, | ||||||
| 122 | categorie,langue,parse,valide,niveau, | ||||||
| 123 | last_check,last_update,browse_categorie | ||||||
| 124 | from ".$self->{INDEXER}->pre_tbl.$compte."links | ||||||
| 125 | where id=".$id); | ||||||
| 126 | # print "load $id:", join(' ',@l),"\n"; | ||||||
| 127 | 0 | 0 | return 0 if (!@l); | ||||
| 128 | 0 | my %tab= | |||||
| 129 | ( url => $l[0], | ||||||
| 130 | local_url => $l[1], | ||||||
| 131 | titre => $l[2], | ||||||
| 132 | description => $l[3], | ||||||
| 133 | categorie => $l[4], | ||||||
| 134 | langue => $l[5], | ||||||
| 135 | parse => $l[6], | ||||||
| 136 | valide => $l[7], | ||||||
| 137 | niveau => $l[8], | ||||||
| 138 | last_check => $l[9], | ||||||
| 139 | last_update => $l[10], | ||||||
| 140 | browse_categorie => $l[11], | ||||||
| 141 | ); | ||||||
| 142 | 0 | return \%tab; | |||||
| 143 | } | ||||||
| 144 | |||||||
| 145 | #------------------------------------------------------------------------------ | ||||||
| 146 | # delete | ||||||
| 147 | #------------------------------------------------------------------------------ | ||||||
| 148 | sub delete { | ||||||
| 149 | 0 | 0 | 1 | my ($this,$compte,$id_url)=@_; | |||
| 150 | 0 | $this->{DBH}->do | |||||
| 151 | ("delete from ".$this->{INDEXER}->pre_tbl.$compte."relation". | ||||||
| 152 | "where id_site = $id_url"); | ||||||
| 153 | 0 | 0 | my $r = $this->{DBH}->do("delete from ".$this->{INDEXER}->pre_tbl.$compte. | ||||
| 154 | "links where id = $id_url") || return 0; | ||||||
| 155 | 0 | 0 | 0 | return ((!$r or $r eq '0E0') ? 0 : 1); | |||
| 156 | } | ||||||
| 157 | |||||||
| 158 | #------------------------------------------------------------------------------ | ||||||
| 159 | # delete_all_non_valid | ||||||
| 160 | #------------------------------------------------------------------------------ | ||||||
| 161 | sub delete_all_non_valid { | ||||||
| 162 | 0 | 0 | 1 | my ($self,$id)=@_; | |||
| 163 | 0 | my $tt = 0; | |||||
| 164 | 0 | 0 | my $tab = $self->a_valider($id) || return undef; | ||||
| 165 | 0 | foreach (keys %$tab) {$tt += $self->delete($id,$_);} | |||||
| 0 | |||||||
| 166 | 0 | return $tt; | |||||
| 167 | } | ||||||
| 168 | |||||||
| 169 | #------------------------------------------------------------------------------ | ||||||
| 170 | # valid_all_non_valid | ||||||
| 171 | #------------------------------------------------------------------------------ | ||||||
| 172 | sub valid_all_non_valid { | ||||||
| 173 | 0 | 0 | 1 | my ($self,$id)=@_; | |||
| 174 | 0 | my $tt = 0; | |||||
| 175 | 0 | 0 | my $tab = $self->a_valider($id) || return undef; | ||||
| 176 | 0 | foreach (keys %$tab) {$tt+= $self->valide($id,$_);} | |||||
| 0 | |||||||
| 177 | 0 | return $tt; | |||||
| 178 | } | ||||||
| 179 | |||||||
| 180 | #------------------------------------------------------------------------------ | ||||||
| 181 | # need_parser | ||||||
| 182 | #------------------------------------------------------------------------------ | ||||||
| 183 | sub need_parser { | ||||||
| 184 | 0 | 0 | 0 | my ($self,$idp)=@_; | |||
| 185 | 0 | my %tab; | |||||
| 186 | 0 | my $requete="select id,url,local_url,niveau,categorie ". | |||||
| 187 | "from ".$self->{INDEXER}->pre_tbl.$idp."links ". | ||||||
| 188 | "where parse='0' and valide=1 ". | ||||||
| 189 | "order by niveau,id"; | ||||||
| 190 | 0 | my $sth = $self->{DBH}->prepare($requete); | |||||
| 191 | 0 | 0 | if ($sth->execute()) { | ||||
| 0 | |||||||
| 192 | 0 | while (my @row=$sth->fetchrow_array) { | |||||
| 193 | 0 | my $id = shift @row; | |||||
| 194 | 0 | $tab{$id}[0]=$row[0]; # url | |||||
| 195 | 0 | $tab{$id}[1]=$row[1]; # local_url | |||||
| 196 | 0 | $tab{$id}[2]=$row[2]; # niveau | |||||
| 197 | 0 | $tab{$id}[3]=$row[3]; # categorie | |||||
| 198 | } | ||||||
| 199 | } | ||||||
| 200 | else {print "\nDid you call create before ?\n";} | ||||||
| 201 | 0 | $sth->finish; | |||||
| 202 | 0 | return \%tab; | |||||
| 203 | } | ||||||
| 204 | |||||||
| 205 | #------------------------------------------------------------------------------ | ||||||
| 206 | # liens | ||||||
| 207 | #------------------------------------------------------------------------------ | ||||||
| 208 | sub liens | ||||||
| 209 | { | ||||||
| 210 | 0 | 0 | 0 | my ($self,$id)=@_; | |||
| 211 | 0 | my %tab; | |||||
| 212 | 0 | my $sth = $self->{DBH}->prepare | |||||
| 213 | ("select id,url from ".$self->{INDEXER}->pre_tbl.$id."links"); | ||||||
| 214 | 0 | 0 | $sth->execute() || print $DBI::errstr," \n"; |
||||
| 215 | 0 | while (my @row=$sth->fetchrow_array) | |||||
| 216 | { | ||||||
| 217 | 0 | $self->{INDEXER}->set_host_indexed($row[1]); | |||||
| 218 | 0 | my $racine=$self->{INDEXER}->host_indexed; | |||||
| 219 | 0 | $tab{$row[0]}=$row[1]; | |||||
| 220 | 0 | $tab{$row[0]}=~s/www\.//g; | |||||
| 221 | } | ||||||
| 222 | 0 | $sth->finish; | |||||
| 223 | 0 | return \%tab; | |||||
| 224 | } | ||||||
| 225 | |||||||
| 226 | #------------------------------------------------------------------------------ | ||||||
| 227 | # need_update | ||||||
| 228 | #------------------------------------------------------------------------------ | ||||||
| 229 | sub need_update | ||||||
| 230 | { | ||||||
| 231 | 0 | 0 | 1 | my ($self,$idp,$xj)=@_; | |||
| 232 | 0 | my %tab; | |||||
| 233 | 0 | my $requete="select id,url,local_url,niveau,categorie, | |||||
| 234 | UNIX_TIMESTAMP(last_update) | ||||||
| 235 | from ".$self->{INDEXER}->pre_tbl.$idp."links | ||||||
| 236 | where TO_DAYS(NOW()) >= (TO_DAYS(last_check) + $xj) | ||||||
| 237 | and valide=1 order by niveau,last_update"; | ||||||
| 238 | 0 | my $sth = $self->{DBH}->prepare($requete); | |||||
| 239 | 0 | 0 | if ($sth->execute()) | ||||
| 240 | 0 | { | |||||
| 241 | 0 | while (my @row=$sth->fetchrow_array) | |||||
| 242 | { | ||||||
| 243 | 0 | my $id = shift @row; | |||||
| 244 | 0 | $tab{$id}[0]=$row[0]; # url | |||||
| 245 | 0 | $tab{$id}[1]=$row[1]; # local_url | |||||
| 246 | 0 | $tab{$id}[2]=$row[2]; # niveau | |||||
| 247 | 0 | $tab{$id}[3]=$row[3]; # categorie | |||||
| 248 | 0 | $tab{$id}[4]=$row[4]; # last_update | |||||
| 249 | } | ||||||
| 250 | } | ||||||
| 251 | else {print "\nDid you call create before ?\n";} | ||||||
| 252 | 0 | $sth->finish; | |||||
| 253 | 0 | return \%tab; | |||||
| 254 | } | ||||||
| 255 | |||||||
| 256 | #------------------------------------------------------------------------------ | ||||||
| 257 | # a_valider | ||||||
| 258 | #------------------------------------------------------------------------------ | ||||||
| 259 | sub a_valider | ||||||
| 260 | { | ||||||
| 261 | 0 | 0 | 1 | my ($self,$id)=@_; | |||
| 262 | 0 | my (%tab); | |||||
| 263 | 0 | my $sth = $self->{DBH}->prepare("select id,url from ". | |||||
| 264 | $self->{INDEXER}->pre_tbl.$id."links ". | ||||||
| 265 | "where valide=0"); | ||||||
| 266 | 0 | 0 | $sth->execute() || return undef; | ||||
| 267 | 0 | while (my @row=$sth->fetchrow_array) | |||||
| 268 | { | ||||||
| 269 | 0 | $self->{INDEXER}->set_host_indexed($row[1]); | |||||
| 270 | 0 | my $racine=$self->{INDEXER}->host_indexed; | |||||
| 271 | 0 | $tab{$row[0]}=$row[1]; | |||||
| 272 | 0 | $tab{$row[0]}=~s/www\.//g; | |||||
| 273 | } | ||||||
| 274 | 0 | $sth->finish; | |||||
| 275 | 0 | return \%tab; | |||||
| 276 | } | ||||||
| 277 | |||||||
| 278 | #------------------------------------------------------------------------------ | ||||||
| 279 | # valide | ||||||
| 280 | #------------------------------------------------------------------------------ | ||||||
| 281 | sub valide { | ||||||
| 282 | 0 | 0 | 1 | my ($this,$compte,$id_url)=@_; | |||
| 283 | 0 | 0 | my $r=$this->{DBH}->do("update ".$this->{INDEXER}->pre_tbl.$compte."links ". | ||||
| 284 | "set valide=1,parse='0' where id = $id_url") | ||||||
| 285 | || return 0; | ||||||
| 286 | 0 | 0 | 0 | return ((!$r or $r eq '0E0') ? 0 : 1); | |||
| 287 | } | ||||||
| 288 | |||||||
| 289 | #------------------------------------------------------------------------------ | ||||||
| 290 | # non_valide | ||||||
| 291 | #------------------------------------------------------------------------------ | ||||||
| 292 | sub non_valide { | ||||||
| 293 | 0 | 0 | 1 | my ($this,$compte,$id_url)=@_; | |||
| 294 | 0 | 0 | my $r=$this->{DBH}->do("update ".$this->{INDEXER}->pre_tbl.$compte."links". | ||||
| 295 | " set valide='0' where id=".$id_url) | ||||||
| 296 | || return 0; | ||||||
| 297 | 0 | 0 | 0 | return ((!$r or $r eq '0E0') ? 0 : 1); | |||
| 298 | } | ||||||
| 299 | |||||||
| 300 | #------------------------------------------------------------------------------ | ||||||
| 301 | # POD DOCUMENTATION | ||||||
| 302 | #------------------------------------------------------------------------------ | ||||||
| 303 | |||||||
| 304 | =head1 NAME | ||||||
| 305 | |||||||
| 306 | Search::Circa::Url - provide functions to manage url of Circa | ||||||
| 307 | |||||||
| 308 | =head1 VERSION | ||||||
| 309 | |||||||
| 310 | $Revision: 1.19 $ | ||||||
| 311 | |||||||
| 312 | =head1 SYNOPSIS | ||||||
| 313 | |||||||
| 314 | use Search::Circa::Indexer; | ||||||
| 315 | my $index = new Search::Circa::Indexer; | ||||||
| 316 | $index->connect(...); | ||||||
| 317 | $index->URL->add($account,%url) || | ||||||
| 318 | print "Can't add $url{url} : $DBI::errstr\n"; | ||||||
| 319 | $index->URL->del($account,$id_url); | ||||||
| 320 | |||||||
| 321 | =head1 DESCRIPTION | ||||||
| 322 | |||||||
| 323 | This module is used by Search::Circa::Indexer module to manage Url of Circa | ||||||
| 324 | |||||||
| 325 | |||||||
| 326 | =head1 Hash %url | ||||||
| 327 | |||||||
| 328 | Sometimes I use a hash call url as parameter. (update,add,load method). | ||||||
| 329 | Here are possible field: | ||||||
| 330 | |||||||
| 331 | =over | ||||||
| 332 | |||||||
| 333 | =item id | ||||||
| 334 | |||||||
| 335 | Id of url (use only on update) | ||||||
| 336 | |||||||
| 337 | =item url | ||||||
| 338 | |||||||
| 339 | Url use to get content if local_url isn't define | ||||||
| 340 | |||||||
| 341 | =item local_url | ||||||
| 342 | |||||||
| 343 | Url with file:// protocol. In search, url will be displayed, else in | ||||||
| 344 | indexer, url_local is used. | ||||||
| 345 | |||||||
| 346 | =item browse_categorie | ||||||
| 347 | |||||||
| 348 | 0 ou 1. (Apparait ou pas dans la navigation par categorie). Si non present, 0. | ||||||
| 349 | |||||||
| 350 | =item niveau | ||||||
| 351 | |||||||
| 352 | Profondeur de l'indexation pour ce document. Si non present, positionné ŕ 0. | ||||||
| 353 | |||||||
| 354 | =item categorie | ||||||
| 355 | |||||||
| 356 | Categorie de cet url. Si non present, positionné ŕ 0. | ||||||
| 357 | |||||||
| 358 | =item titre | ||||||
| 359 | |||||||
| 360 | Title of document | ||||||
| 361 | |||||||
| 362 | =item description | ||||||
| 363 | |||||||
| 364 | Description of document | ||||||
| 365 | |||||||
| 366 | =item langue | ||||||
| 367 | |||||||
| 368 | Langue of document | ||||||
| 369 | |||||||
| 370 | =item last_check | ||||||
| 371 | |||||||
| 372 | Last check of Indexer | ||||||
| 373 | |||||||
| 374 | =item last_update | ||||||
| 375 | |||||||
| 376 | Last update of document | ||||||
| 377 | |||||||
| 378 | =item valide | ||||||
| 379 | |||||||
| 380 | Is document reachable ? | ||||||
| 381 | |||||||
| 382 | =item parse | ||||||
| 383 | |||||||
| 384 | Does Circa already known this url ? | ||||||
| 385 | |||||||
| 386 | =back | ||||||
| 387 | |||||||
| 388 | |||||||
| 389 | |||||||
| 390 | =head1 Public Class Interface | ||||||
| 391 | |||||||
| 392 | =over | ||||||
| 393 | |||||||
| 394 | =item new($indexer_instance) | ||||||
| 395 | |||||||
| 396 | Create a new Circa::Url object with indexer instance properties | ||||||
| 397 | |||||||
| 398 | =item add($idMan,%url) | ||||||
| 399 | |||||||
| 400 | Add url %url for account $idMan. | ||||||
| 401 | If error (account undefined, no account, no url) return 0. You can ask | ||||||
| 402 | $DBI::errstr to know why) or 1 if ok. | ||||||
| 403 | |||||||
| 404 | =item load($compte,$id) | ||||||
| 405 | |||||||
| 406 | Return reference to hash %url for id $id, account $compte. | ||||||
| 407 | If error (id undefined, no id, no account) return 0. You can ask | ||||||
| 408 | $DBI::errstr to know why) or 1 if ok. | ||||||
| 409 | |||||||
| 410 | =item update($compte,%url) | ||||||
| 411 | |||||||
| 412 | Update url %url for account $compte. | ||||||
| 413 | If error (id undefined, no id, no account) return 0. You can ask | ||||||
| 414 | $DBI::errstr to know why) or 1 if ok. Field url can't be updated. | ||||||
| 415 | |||||||
| 416 | =item delete($compte,$id_url) | ||||||
| 417 | |||||||
| 418 | Delete url with id $id_url on account $compte (clean table links/releation) | ||||||
| 419 | If error (id undefined, no id, no account) return 0. You can ask | ||||||
| 420 | $DBI::errstr to know why) | ||||||
| 421 | |||||||
| 422 | =item delete_all_non_valid($id) | ||||||
| 423 | |||||||
| 424 | Delete all non valid url found for account $id | ||||||
| 425 | |||||||
| 426 | =item need_update($id,$xj) | ||||||
| 427 | |||||||
| 428 | Return reference of hash with id/url for url not parsed since $xj days | ||||||
| 429 | |||||||
| 430 | =item need _parser($id) | ||||||
| 431 | |||||||
| 432 | Return reference of hash with id/url for url never parser (column parser=0) | ||||||
| 433 | |||||||
| 434 | =item a_valider($compte) | ||||||
| 435 | |||||||
| 436 | Return reference of hash with id/url of url not valid | ||||||
| 437 | |||||||
| 438 | =item valid_all_non_valid($id) | ||||||
| 439 | |||||||
| 440 | Valid all non valid url found for account $id | ||||||
| 441 | |||||||
| 442 | =item valide($compte,$id_url) | ||||||
| 443 | |||||||
| 444 | Commit link $id_url on table $compte/links | ||||||
| 445 | |||||||
| 446 | Valide le lien $id_url | ||||||
| 447 | |||||||
| 448 | =item non_valide($compte,$id_url) | ||||||
| 449 | |||||||
| 450 | Set url $id_url as non valide. Ignore link $id_url on search (bad link). | ||||||
| 451 | |||||||
| 452 | =back | ||||||
| 453 | |||||||
| 454 | =head1 AUTHOR | ||||||
| 455 | |||||||
| 456 | Alain BARBET alian@alianwebserver.com | ||||||
| 457 | |||||||
| 458 | =cut |