Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d11-5.9.1d12.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d11-5.9.1d12.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d11-5.9.1d12.sql 9 Apr 2016 14:43:59 -0000 1.1.2.1 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d11-5.9.1d12.sql 2 Aug 2016 20:31:11 -0000 1.1.2.2 @@ -2,10 +2,34 @@ -- Update mime_type to official content type as registered by IANA. -- The changes have to be performed in a transaction, therefore the inline function. -- + +create or replace function inline_0 ( + p_label in varchar, + p_extension in varchar, + p_old_mime_type in varchar, + p_new_mime_type in varchar +) +return integer +as begin - delete from cr_extension_mime_type_map where mime_type = 'application/x-shockwave-flash'; - update cr_mime_types set mime_type = 'application/vnd.adobe.flash-movie' where mime_type = 'application/x-shockwave-flash'; - update cr_revisions set mime_type = 'application/vnd.adobe.flash-movie' where mime_type = 'application/x-shockwave-flash'; - insert into cr_extension_mime_type_map (extension, mime_type) values ( 'swf','application/vnd.adobe.flash-movie' ); + delete from cr_extension_mime_type_map where mime_type = p_old_mime_type; + + insert into cr_mime_types(label, mime_type, file_extension) + select p_label, p_new_mime_type, p_extension from dual + where not exists (select 1 from cr_mime_types where mime_type = p_new_mime_type); + + update cr_content_mime_type_map set mime_type = p_new_mime_type where mime_type = p_old_mime_type; + update cr_revisions set mime_type = p_new_mime_type where mime_type = p_old_mime_type; + + insert into cr_extension_mime_type_map (extension, mime_type) + select p_extension, p_new_mime_type from dual + where not exists (select 1 from cr_extension_mime_type_map where mime_type = p_new_mime_type); + + delete from cr_mime_types where mime_type = p_old_mime_type; + return 1; end; +/ +select inline_0('Macromedia Shockwave','swf','application/x-shockwave-flash','application/vnd.adobe.flash-movie') from dual; + +drop function inline_0; Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d12-5.9.1d13.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d12-5.9.1d13.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d12-5.9.1d13.sql 26 Apr 2016 07:48:27 -0000 1.1.2.1 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d12-5.9.1d13.sql 2 Aug 2016 20:31:11 -0000 1.1.2.2 @@ -2,6 +2,7 @@ -- Update mime_type to official content type as registered by IANA. -- The changes have to be performed in a transaction, therefore the inline function. -- + create or replace function inline_0 ( p_label in varchar, p_extension in varchar, Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d13-5.9.1d14.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d13-5.9.1d14.sql,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d13-5.9.1d14.sql 3 May 2016 06:23:59 -0000 1.1.2.2 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d13-5.9.1d14.sql 2 Aug 2016 20:31:11 -0000 1.1.2.3 @@ -2,6 +2,7 @@ -- Update mime_type to official content type as registered by IANA. -- The changes have to be performed in a transaction, therefore the inline function. -- + create or replace function inline_0 ( p_label in varchar, p_extension in varchar, Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d15-5.9.1d16.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d15-5.9.1d16.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d15-5.9.1d16.sql 26 May 2016 19:23:20 -0000 1.1.2.1 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.9.1d15-5.9.1d16.sql 2 Aug 2016 20:31:11 -0000 1.1.2.2 @@ -2,6 +2,7 @@ -- Update mime_type to official content type as registered by IANA. -- The changes have to be performed in a transaction, therefore the inline function. -- + create or replace function inline_0 ( p_label in varchar, p_extension in varchar,