victorg
committed
on 02 May 13
When fetching files for a given package we also want to retrieve sql files.
openacs-4/.../tcl/apm-install-procs.tcl (+2 -2)
1725 1725     {-upgrade_to_version_name ""}
1726 1726     {-package_path ""}
1727 1727     package_key
1728 1728 } {
1729 1729     @param version_id What version the files belong to.
1730 1730     @param upgrade Set this switch if you want the scripts for upgrading.
1731 1731     @file_list A list of files and file types of form [list [list "foo.sql" "data_model_upgrade"] ...]
1732 1732 } {
1733 1733     set types_to_retrieve [list "sqlj_code"]
1734 1734     if {$upgrade_from_version_name eq ""} {
1735 1735         lappend types_to_retrieve "data_model_create"
1736 1736         # Assuming here that ctl_file files are not upgrade scripts
1737 1737         # TODO: Make it possible to determine which ctl files are upgrade scripts and which aren't
1738 1738         lappend types_to_retrieve "ctl_file"
1739 1739     } else {
1740 1740         lappend types_to_retrieve "data_model_upgrade"
1741 1741     }
1742 1742     set data_model_list [list]
1743 1743     set upgrade_file_list [list]
1744 1744     set ctl_file_list [list]
1745       set file_list [apm_get_package_files -file_types $types_to_retrieve -package_path $package_path -package_key $package_key]
  1745     set file_list [apm_get_package_files -include_data_model_files -file_types $types_to_retrieve -package_path $package_path -package_key $package_key]
1746 1746
1747 1747     foreach path $file_list {
1748 1748         set file_type [apm_guess_file_type $package_key $path]
1749 1749         set file_db_type [apm_guess_db_type $package_key $path]
1750 1750         apm_log APMDebug "apm_data_model_scripts_find: Checking \"$path\" of type \"$file_type\" and db_type \"$file_db_type\"."
1751 1751
1752 1752         if {[lsearch -exact $types_to_retrieve $file_type] != -1 } {
1753 1753             set list_item [list $path $file_type $package_key]
1754 1754             if {$file_type eq "data_model_upgrade"} {
1755 1755                 # Upgrade script
1756 1756                 if {[apm_upgrade_for_version_p $path $upgrade_from_version_name \
1757 1757                         $upgrade_to_version_name]} {
1758 1758                     # Its a valid upgrade script.
1759 1759                     ns_log Debug "apm_data_model_scripts_find: Adding $path to the list of upgrade files."
1760 1760                     lappend upgrade_file_list $list_item
1761 1761                 }
1762 1762             } elseif {$file_type eq "ctl_file"} {
1763 1763                 lappend ctl_file_list $list_item
1764 1764             } else {
1765 1765                 # Install script