ad_update_robot_list

one of the documented procedures in this installation of the ACS
Usage:
ad_update_robot_list
What it does:
Will update the robots table if it is empty or if the number of days since it was last updated is greater than the number of days specified by the RefreshIntervalDays configuration parameter in the "robot-detection" section
Defined in: /web/philip/tcl/ad-robot-defs.tcl

Source code:


    set db [ns_db gethandle]
    ns_db dml $db "begin transaction"
    if [catch {
	set robot_count [database_to_tcl_string $db "select count(*) from robots"]
	if {$robot_count == 0} {
	    ns_log Notice "Replicating Web Robots DB, because robots table is empty"
	    ad_replicate_web_robots_db $db
	} else {
	    set refresh_interval [ad_parameter RefreshIntervalDays robot-detection]
	    if {$refresh_interval == ""} {
		set refresh_interval 30	;# refresh every 30 days by default
	    }

	    set days_old [database_to_tcl_string $db  "select trunc(sysdate - max(nvl(modified_date, insertion_date))) as n_days from robots"]
	    if {$days_old > $refresh_interval} {
		ns_log Notice "Replicating Web Robots DB, because data in robots table has expired"
		ad_replicate_web_robots_db $db
	    } else {
		ns_log Notice "Not replicating Web Robots DB at this time, because data in the robots table has not expired"
	    }
	}
    } errmsg] {
	ad_notify_host_administrator "Error encountered in ad_update_robot_list" $errmsg
	return
    }
    ns_db dml $db "end transaction"


philg@mit.edu