Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.109.2.12 -r1.109.2.13 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 22 Sep 2016 17:28:07 -0000 1.109.2.12 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 16 Nov 2016 19:06:04 -0000 1.109.2.13 @@ -1137,9 +1137,7 @@ ad_proc -private apm_package_delete { {-sql_drop_scripts ""} - { - -callback apm_dummy_callback - } + {-callback apm_dummy_callback} {-remove_files:boolean} package_key } { @@ -1150,7 +1148,8 @@ the package from the APM tables. } { - set version_id [apm_version_id_from_package_key -all $package_key] + # get the supposedly unique enabled version of this package + set version_id [apm_version_id_from_package_key $package_key] # Unmount all instances of this package with the Tcl API that # invokes before-unmount callbacks @@ -1891,8 +1890,19 @@ @author Lars Pind } { - db_1row select_sortable_versions {} - return [string compare $sortable_version_1 $sortable_version_2] + regsub -all {[^0-9]+} $version_name_1 {.} version_name_1 + regsub -all {[^0-9]+} $version_name_2 {.} version_name_2 + + foreach token_1 [split $version_name_1 .] token_2 [split $version_name_2 .] { + if {$token_1 eq ""} {set token_1 0} + if {$token_2 eq ""} {set token_2 0} + if {$token_1 > $token_2} {return 1} + if {$token_2 > $token_1} {return -1} + } + + return 0 + # db_1row select_sortable_versions {} + # return [string compare $sortable_version_1 $sortable_version_2] } ad_proc -private apm_upgrade_logic_compare { Index: openacs-4/packages/acs-tcl/tcl/apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-procs.tcl,v diff -u -r1.95.2.6 -r1.95.2.7 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 13 Jun 2016 17:15:04 -0000 1.95.2.6 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 16 Nov 2016 19:06:04 -0000 1.95.2.7 @@ -1301,12 +1301,15 @@ Return the id of the (per default enabled) version of the given package_key. If no such version id can be found, returns the empty string. - @param all when specified, return the the enabled or disabled version_id of the package_key. + @param all when specified, return the the enabled or disabled version_ids of the package_key. @param package_key @author Peter Marklund + + @return the supposedly unique version_id for the enabled package, or a list of + all the enabled and disabled version when -all flag is specified } { if {$all_p} { - return [db_string get_id {} -default ""] + return [db_list get_id {}] } else { return [db_string get_enabled_id {} -default ""] }