Index: openacs-4/packages/acs-tcl/tcl/apm-file-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-file-procs-oracle.xql,v diff -u -r1.7.30.1 -r1.7.30.2 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs-oracle.xql 2 Jan 2016 11:22:34 -0000 1.7.30.1 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs-oracle.xql 7 Feb 2017 17:49:01 -0000 1.7.30.2 @@ -3,40 +3,6 @@ oracle8.1.6 - - - -begin - :1 := content_item.new(name => :name, - creation_ip => :creation_ip, - storage_type => 'file' - ); -end; - - - - - - - - begin - :1 := content_revision.new(title => :title, - description => 'gzipped tarfile', - text => 'not_important', - mime_type => 'text/plain', - item_id => :item_id, - creation_user => :user_id, - creation_ip => :creation_ip - ); - - update cr_items - set live_revision = :1 - where item_id = :item_id; - end; - - - - Index: openacs-4/packages/acs-tcl/tcl/apm-file-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-file-procs-postgresql.xql,v diff -u -r1.13.30.1 -r1.13.30.2 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs-postgresql.xql 2 Jan 2016 11:22:35 -0000 1.13.30.1 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs-postgresql.xql 7 Feb 2017 17:49:01 -0000 1.13.30.2 @@ -3,63 +3,6 @@ postgresql7.1 - - - -select content_item__new( - varchar :name, - null, - null, - null, - now(), - null, - null, - :creation_ip, - 'content_item', - 'content_revision', - null, - null, - 'text/plain', - null, - null, - 'file' - ) - - - - - - - - declare - v_revision_id integer; - begin - - v_revision_id := content_revision__new( - :title, - 'gzipped tarfile', - now(), - 'text/plain', - null, - 'not_important', - :item_id, - null, - now(), - :user_id, - :creation_ip - ); - - update cr_items - set live_revision = v_revision_id - where item_id = :item_id; - - return v_revision_id; - - end; - - - - Index: openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl,v diff -u -r1.36.2.7 -r1.36.2.8 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 2 Feb 2017 14:00:35 -0000 1.36.2.7 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs.tcl 7 Feb 2017 17:49:01 -0000 1.36.2.8 @@ -162,14 +162,10 @@ } { set package_key [apm_package_key_from_version_id $version_id] - set files [apm_get_package_files -all_db_types -package_key $package_key] + set files [apm_get_package_files -all -package_key $package_key] set tmpfile [ad_tmpnam] - db_1row package_key_select { - select package_key - from apm_package_version_info - where version_id = :version_id - } + db_1row package_key_select {} # Generate a command like: # @@ -200,12 +196,7 @@ set description "gzipped tarfile" set mime_type "text/plain" - db_1row item_exists_p {select case when item_id is null - then 0 - else item_id - end as item_id - from apm_package_versions - where version_id = :version_id} + db_1row item_exists_p {} if {!$item_id} { # content item hasen't been created yet - create one. @@ -217,29 +208,25 @@ -creation_user $user_id \ -creation_ip $creation_ip \ -is_live true] - set revision_id [content::item::get_live_revision -item_id $item_id] - db_dml set_item_id "update apm_package_versions - set item_id = :item_id - where version_id = :version_id" - } else { - #tarball exists, so all we have to do is to make a new revision for it - #Let's check if a current revision exists: - if {![db_0or1row get_revision_id { - select live_revision as revision_id - from cr_items - where item_id = :item_id - }] || $revision_id eq ""} { - # It's an insert rather than an update - set revision_id [content::revision::new -item_id $item_id \ - -title $title \ - -description $description \ - -mime_type $mime_type \ - -creation_user $user_id \ - -creation_ip $creation_ip \ - -is_live true] - } + + db_dml set_item_id {} } + set revision_id [content::item::get_live_revision -item_id $item_id] + + # No live revision for this item. Possible if somebody already + # generated the archive, then deleted or modified the revision + # manually or by other means. We create a new live revision. + if {$revision_id eq ""} { + set revision_id [content::revision::new -item_id $item_id \ + -title $title \ + -description $description \ + -mime_type $mime_type \ + -creation_user $user_id \ + -creation_ip $creation_ip \ + -is_live true] + } + db_dml update_tarball {} -blob_files [list $tmpfile] db_dml update_content_length {} Index: openacs-4/packages/acs-tcl/tcl/apm-file-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-file-procs.xql,v diff -u -r1.5 -r1.5.24.1 --- openacs-4/packages/acs-tcl/tcl/apm-file-procs.xql 24 Sep 2003 17:51:24 -0000 1.5 +++ openacs-4/packages/acs-tcl/tcl/apm-file-procs.xql 7 Feb 2017 17:49:01 -0000 1.5.24.1 @@ -21,16 +21,6 @@ - - - - select live_revision as revision_id - from cr_items - where item_id = :item_id - - - - select db_type_key from apm_package_db_types