Index: openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl,v diff -u -r1.34 -r1.35 --- openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl 11 Feb 2019 11:42:11 -0000 1.34 +++ openacs-4/packages/acs-bootstrap-installer/bootstrap.tcl 3 Sep 2024 15:37:30 -0000 1.35 @@ -16,15 +16,18 @@ # point later). This is used in /www/admin/monitoring/startup-log.tcl to show # the segment of the error log corresponding to server initialization (between # "AOLserver/xxx starting" and "AOLserver/xxx running"). -catch { nsv_set acs_properties initial_error_log_length [file size [ns_info log]] } +# +# GN: not used anymore, but could be reactivated in the future. Note, that +# the system log might be spooled to stderr or the like. +#catch { nsv_set acs_properties initial_error_log_length [file size [ns_info log]] } # Initialize proc_doc NSV arrays. nsv_set proc_source_file . "" # Initialize ad_after_server_initialization. nsv_set ad_after_server_initialization . "" -ns_log Notice "bootstrap begin encoding [encoding system]" +ns_log Notice "OpenACS bootstrap begin encoding [encoding system]" ### # @@ -33,7 +36,7 @@ ### # A helper procedure called if a fatal error occurs. -proc bootstrap_fatal_error { message { throw_error_p 1 } } { +proc acs_bootstrap_fatal_error { message { throw_error_p 1 } } { # First of all, redefine the "rp_invoke_filter" and "rp_invoke_procs" # routines to do nothing, to circumvent the request processor. proc rp_invoke_filter { conn arg why } { return "filter_ok" } @@ -47,8 +50,8 @@ # Define a filter procedure which displays the appropriate error message. proc bootstrap_write_error { args } { - ns_returnerror 503 "Server startup failed: [nsv_get bootstrap_fatal_error .]" - return "filter_return" + ns_returnerror 503 "Server startup failed: [nsv_get bootstrap_fatal_error .]" + return "filter_return" } # Register the filter on GET/POST/HEAD * to return this message. @@ -57,24 +60,24 @@ ns_register_filter preauth HEAD * bootstrap_write_error if { $throw_error_p } { - return -code error -errorcode bootstrap_fatal_error "Bootstrap fatal error" + return -code error -errorcode bootstrap_fatal_error "Bootstrap fatal error" } } set errno [catch { # Used for ns_logs: - set proc_name {Bootstrap} + set proc_name Bootstrap # Load the special bootstrap Tcl library. set files [lsort [glob -nocomplain "$::acs::rootdir/packages/acs-bootstrap-installer/tcl/*-procs.tcl"]] if { [llength $files] == 0 } { - error "Unable to locate $::acs::rootdir/packages/acs-bootstrap-installer/tcl/*-procs.tcl." + error "Unable to locate $::acs::rootdir/packages/acs-bootstrap-installer/tcl/*-procs.tcl." } foreach file [lsort $files] { - ns_log Notice "$proc_name: sourcing $file" - source $file + ns_log Notice "$proc_name: sourcing $file" + source $file } db_bootstrap_set_db_type database_problem @@ -103,8 +106,8 @@ apm_bootstrap_load_libraries -procs acs-tcl if { [info exists database_problem] } { - # Yikes - database problems. - ns_log Error "$proc_name: $database_problem" + # Yikes - database problems. + ns_log Error "$proc_name: $database_problem" # Check if the admin enabled the site-failure message, display # it if enabled. @@ -115,11 +118,11 @@ } # Remember what the problem is, and run the installer. - nsv_set acs_properties database_problem $database_problem - ns_log Notice "$proc_name: database problem found; Sourcing the installer." - source "$::acs::rootdir/packages/acs-bootstrap-installer/installer.tcl" - source "$::acs::rootdir/packages/acs-bootstrap-installer/installer-init.tcl" - return + nsv_set acs_properties database_problem $database_problem + ns_log Notice "$proc_name: database problem found; Sourcing the installer." + source "$::acs::rootdir/packages/acs-bootstrap-installer/installer.tcl" + source "$::acs::rootdir/packages/acs-bootstrap-installer/installer-init.tcl" + return } # Here we need to at least load up queries for the acs-tcl and @@ -130,12 +133,12 @@ # Is OpenACS installation complete? If not, source the installer and bail out. if { ![ad_verify_install] } { - ns_log warning "$proc_name: Installation is not complete - sourcing the installer." - source "$::acs::rootdir/packages/acs-bootstrap-installer/installer.tcl" - source "$::acs::rootdir/packages/acs-bootstrap-installer/installer-init.tcl" - return + ns_log warning "$proc_name: Installation is not complete - sourcing the installer." + source "$::acs::rootdir/packages/acs-bootstrap-installer/installer.tcl" + source "$::acs::rootdir/packages/acs-bootstrap-installer/installer-init.tcl" + return } - + # # The installation is apparently ok, we can use the database. It # should not be necessary to use the [ad_acs_kernel_id] redefine @@ -146,15 +149,17 @@ # # Load all parameters for enabled package instances. - # ad_parameter_cache_all - + # ad_parameter_cache_all + # Load the Tcl package init files. apm_bootstrap_load_libraries -init acs-tcl # LARS: Load packages/acs-automated-testing/tcl/aa-test-procs.tcl - ns_log Notice "Loading acs-automated-testing specially so other packages can define tests..." - apm_bootstrap_load_libraries -procs acs-automated-testing - + if {[apm_load_tests_p]} { + ns_log Notice "Loading acs-automated-testing specially so other packages can define tests..." + apm_bootstrap_load_libraries -procs acs-automated-testing + } + # Build the list of subsite packages apm_build_subsite_packages_list @@ -170,10 +175,10 @@ apm_load_packages -load_libraries_p 0 -load_queries_p 0 -packages acs-tcl if { ![nsv_exists rp_properties request_count] } { - # security-init.tcl has not been invoked, so it's safe to say that the - # core has not been properly initialized and the server will probably - # fail catastrophically. - bootstrap_fatal_error "The request processor routines have not been loaded." + # security-init.tcl has not been invoked, so it's safe to say that the + # core has not been properly initialized and the server will probably + # fail catastrophically. + acs_bootstrap_fatal_error "The request processor routines have not been loaded." } ns_log Notice "bootstrap finished encoding [encoding system]" @@ -186,10 +191,10 @@ # to guess what broke. # If the $::errorCode is "bootstrap_fatal_error", then the error was explicitly - # thrown by a call to bootstrap_fatal_error. If not, bootstrap_fatal_error was - # never called, so we need to call it now. + # thrown by a call to acs_bootstrap_fatal_error. If not, acs_bootstrap_fatal_error + # was never called, so we need to call it now. if {$::errorCode ne "bootstrap_fatal_error" } { - bootstrap_fatal_error "Error during bootstrapping" 0 + acs_bootstrap_fatal_error "Error during bootstrapping" 0 } }