apm_load_any_changed_librariesWhat it does:
In the running interpreter, reloads files marked for reload by apm_mark_version_for_reload. If any watches are set, examines watched files to see whether they need to be reloaded as well. This is intended to be called only by the request processor (since it should be invoked before any filters or registered procedures are applied).Defined in: /web/philip/packages/acs-core/apm-procs.tcl
Source code:
# Determine the current reload level in this interpreter by calling # apm_reload_level_in_this_interpreter. If this fails, we define the reload level to be # zero. if { [catch { set reload_level [apm_reload_level_in_this_interpreter] } error] } { proc apm_reload_level_in_this_interpreter {} { return 0 } set reload_level 0 } # Check watched files, adding them to files_to_reload if they have # changed. set files_to_reload [list] foreach file [nsv_array names apm_reload_watch] { set path "[acs_root_dir]/packages/$file" if { [file exists $path] && [file mtime $path] != [nsv_get apm_library_mtime $file] } { lappend files_to_reload $file nsv_set apm_library_mtime $file [file mtime $path] } } # If there are any changed watched files, stick another entry on the # reload queue. if { [llength $files_to_reload] > 0 } { ns_log "Notice" "Watched file[ad_decode [llength $files_to_reload] 1 "" "s"] [join $files_to_reload ", "] [ad_decode [llength $files_to_reload] 1 "has" "have"] changed: reloading." set new_level [nsv_incr apm_properties reload_level] nsv_set apm_reload $new_level $files_to_reload } set changed_reload_level_p 0 # Keep track of which files we've reloaded in this loop so we never # reload the same one twice. array set reloaded_files [list] while { $reload_level < [nsv_get apm_properties reload_level] } { incr reload_level set changed_reload_level_p 1 # If there's no entry in apm_reload for that reload level, back out. if { ![nsv_exists apm_reload $reload_level] } { incr reload_level -1 break } foreach file [nsv_get apm_reload $reload_level] { # If we haven't yet reloaded the file in this loop, source it. if { ![info exists reloaded_files($file)] } { if { [array size reloaded_files] == 0 } { # Perform this ns_log only during the first iteration of this loop. ns_log "Notice" "Reloading *-procs.tcl files in this interpreter..." } ns_log "Notice" "Reloading $file..." apm_source "[acs_root_dir]/packages/$file" db_release_unused_handles set reloaded_files($file) 1 } } } # We changed the reload level in this interpreter, so redefine the # apm_reload_level_in_this_interpreter proc. if { $changed_reload_level_p } { proc apm_reload_level_in_this_interpreter {} "return $reload_level" }