Index: openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql 20 Nov 2001 02:04:50 -0000 1.4 +++ openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql 12 Feb 2002 00:02:13 -0000 1.5 @@ -464,12 +464,14 @@ declare v_folder_id cr_folders.folder_id%TYPE; begin - v_folder_id := content_folder.new ( + select folder_id into v_folder_id from cr_folders where folder_id = -400; + exception when no_data_found then + v_folder_id := content_folder.new ( name => 'trash', label => 'Trash', description => 'Deleted content items get put here', folder_id => -400 - ); + ); end; / show errors; Index: openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-drop.sql 16 Nov 2001 03:11:08 -0000 1.1 +++ openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-drop.sql 12 Feb 2002 00:02:13 -0000 1.2 @@ -43,10 +43,19 @@ / show errors; -begin - content_folder.delete ( - folder_id => -400 - ); -end; -/ -show errors; +-- although we don't attempt to delete content that was +-- added via ETP, in order to delete the package we must +-- remove the package reference from cr_folders that were +-- created by ETP +update cr_folders set package_id = null +where package_id in (select package_id + from apm_packages + where package_key = 'edit-this-page'); + +-- also kill the package reference in the context_id field +-- of ETP content +update acs_objects set context_id = 0 +where context_id in (select package_id + from apm_packages + where package_key = 'edit-this-page'); + Index: openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql 19 Dec 2001 17:05:07 -0000 1.6 +++ openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql 12 Feb 2002 00:02:13 -0000 1.7 @@ -413,8 +413,12 @@ create function inline_1 () returns integer as ' +declare + v_folder_id integer; begin -perform content_folder__new ( +select folder_id into v_folder_id from cr_folders where folder_id = -400; +if not found then + perform content_folder__new ( ''trash'', ''Trash'', ''Deleted content items get put here'', @@ -425,6 +429,7 @@ null, null ); +end if; return 0; end; ' language 'plpgsql'; Index: openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql 16 Nov 2001 03:11:08 -0000 1.3 +++ openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql 12 Feb 2002 00:02:13 -0000 1.4 @@ -44,17 +44,19 @@ select inline_0 (); drop function inline_0 (); --- this will error if any deleted content exists +-- although we don't attempt to delete content that was +-- added via ETP, in order to delete the package we must +-- remove the package reference from cr_folders that were +-- created by ETP +update cr_folders set package_id = null +where package_id in (select package_id + from apm_packages + where package_key = 'edit-this-page'); -create function inline_1 () -returns integer as ' -begin -perform content_folder__delete ( - -400 - ); -return 0; -end; -' language 'plpgsql'; -select inline_1 (); -drop function inline_1 (); +-- also kill the package reference in the context_id field +-- of ETP content +update acs_objects set context_id = 0 +where context_id in (select package_id + from apm_packages + where package_key = 'edit-this-page');