Changeset 84


Ignore:
Timestamp:
09/11/25 17:37:37 (3 days ago)
Author:
Kris Deugau
Message:

/trunk/uribl

Update semistale import script's module usage to match the others

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/uribl/import-cur.pl

    r41 r84  
    33##
    44# $Id$
    5 # Copyright 2010 Kris Deugau <kdeugau@deepnet.cx>
     5# Copyright 2010,2025 Kris Deugau <kdeugau@deepnet.cx>
    66#
    77#    This program is free software: you can redistribute it and/or modify
     
    2323use DBI;
    2424
    25 use URIdb;
     25# push "the directory the script is in" into @INC
     26use FindBin;
     27use lib "$FindBin::RealBin/";
    2628
    27 my $uridb = new URIdb;
     29use URIdb 2.0;
    2830
    29 # default DB info - all other settings should be loaded from the DB.
    30 my $dbhost = "localhost";
    31 my $dbname = "uridb";
    32 my $dbuser = "uridb";
    33 my $dbpass = "spambgone";
     31die "Usage: import-cur.pl <list>\n"
     32        if !$ARGV[0]
    3433
    35 # Load a config ref containing DB host, name, user, and pass info based on
    36 # from the server name + full script web path.  This allows us to host
    37 # multiple instances without having to duplicate the code.
    38 # This file is a Perl fragment to be processed inline.
    39 if (-e "/etc/uridb/uridb.conf") {
    40   my $cfg = `cat /etc/uridb/uridb.conf`;
    41   ($cfg) = ($cfg =~ /^(.+)$/s);         # avoid warnings, failures, and general nastiness with taint mode
    42   eval $cfg;
    43 }
     34my $cfgname = shift @ARGV;
    4435
    45 my $dbh = $uridb->connect($dbhost, $dbname, $dbuser, $dbpass);
     36my $dbh = $uridb->connect(configfile => "/etc/uridb/$cfgname.conf");
    4637
    4738my $datesth = $dbh->prepare("UPDATE urilist SET added=? WHERE uri=?");
     
    5344  $config{$key} = $value;
    5445}
     46$config{blzone} = 'uribl.company.com' if !$config{blzone};
    5547
    5648my @months = ('null','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
     
    8375  my ($domain,$list,$rest) = split /:/;
    8476  ($list) = ($list =~ /\.(\d+)$/);
    85   $domain =~ s/\.uribl\.company\.com$//;
     77  $domain =~ s/$config{blzone}$//;
    8678  if (!$uridb->exists($domain)) {
    8779    print "adding $domain, $list\n";
Note: See TracChangeset for help on using the changeset viewer.