Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/acs-admin/www/install/local-install-3.adp'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-admin/www/install/local-install-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/install/Attic/local-install-3.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-admin/www/install/local-install-3.tcl 19 Sep 2003 12:59:27 -0000 1.3 +++ openacs-4/packages/acs-admin/www/install/local-install-3.tcl 21 Sep 2003 18:24:19 -0000 1.4 @@ -2,205 +2,184 @@ Install from local file system } +# TODO: Maybe set a body onload handler to display a warning message that the page has stopped loading, +# which it shouldn't. + +# TODO: There's some weird issue with this page causing the entire server to stop serving +# pages if you hit reload. The whole point of moving this into a background thread was to +# let people safely double-click ... + ##### # -# Start progress bar +# Start installation process # ##### -# TODO: We should execute this in a background-thread, so that -# we don't risk running two installation processes at the same time (double-click, or two users) -# TODO: Maybe set a body onload handler to display a warning message that the page has stopped loading, -# which it shouldn't. If people hit reload, we should preferably just re-display the progress bar -# and continue waiting. +set pkg_install_list [ad_get_client_property apm pkg_install_list] +ns_log Notice "Installing: $pkg_install_list" +# We unset the client property so we won't install these packages twice +ad_set_client_property apm pkg_install_list {} + +if { ![empty_string_p $pkg_install_list] } { + util_background_exec -name package-install -pass_vars { pkg_install_list } { + + set sql_files [list] + + foreach pkg_info $pkg_install_list { + ns_log Notice "Installing $pkg_info" + + set package_key [pkg_info_key $pkg_info] + set spec_file [pkg_info_spec $pkg_info] + array set version [apm_read_package_info_file $spec_file] + set final_version_name $version(name) + + if { [apm_package_version_installed_p $version(package.key) $version(name)] } { + # Already installed. + + # Enable this version, in case it's not already enabled + if { ![apm_package_enabled_p $version(package.key)] } { + ns_log Notice "Package $version(package.key) $version(name) is already installed but not enabled, enabling" + apm_version_enable -callback apm_dummy_callback [apm_highest_version $version(package.key)] + } else { + ns_log Notice "Package $version(package.key) $version(name) is already installed and enabled, skipping" + } + + continue + } + + # Determine if we are upgrading or installing. + if { [apm_package_upgrade_p $package_key $final_version_name] == 1} { + ns_log Debug "Upgrading package [string totitle $version(package-name)] to $final_version_name." + set upgrade_p 1 + set initial_version_name [db_string apm_package_upgrade_from { + select version_name from apm_package_versions + where package_key = :package_key + and version_id = apm_package__highest_version(:package_key) + } -default ""] + } else { + set upgrade_p 0 + set initial_version_name "" + } + + # Find out which script is appropriate to be run. + set data_model_in_package 0 + set table_rows "" + set data_model_files [concat \ + [apm_data_model_scripts_find \ + -upgrade_from_version_name $initial_version_name \ + -upgrade_to_version_name $final_version_name \ + $package_key] \ + [apm_ctl_files_find $package_key]] + + # Install the packages. + set version_id [apm_package_install \ + -enable \ + -install_path "[acs_root_dir]/packages" \ + -load_data_model \ + -data_model_files $data_model_files \ + $spec_file] + + if { $version_id == 0 } { + # Installation of the package failed and we shouldn't continue with installation + # as there might be packages depending on the failed package. Ideally we should + # probably check for such dependencies and continue if there are none. + error "Error installing one of the packages" + } + } + } +} + +##### +# +# Display progress bar +# +##### + + ReturnHeaders -ns_write " +ns_write {
- + -