Index: openacs-4/packages/acs-content-repository/acs-content-repository.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v diff -u -r1.113 -r1.114 --- openacs-4/packages/acs-content-repository/acs-content-repository.info 25 Oct 2017 07:33:25 -0000 1.113 +++ openacs-4/packages/acs-content-repository/acs-content-repository.info 29 Jan 2018 14:34:47 -0000 1.114 @@ -7,7 +7,7 @@ t t - + f t OpenACS @@ -21,7 +21,7 @@ GPL 3 - + Index: openacs-4/packages/acs-content-repository/sql/common/mime-type-data.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/common/mime-type-data.sql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-content-repository/sql/common/mime-type-data.sql 7 Aug 2017 23:47:46 -0000 1.11 +++ openacs-4/packages/acs-content-repository/sql/common/mime-type-data.sql 29 Jan 2018 14:34:47 -0000 1.12 @@ -159,6 +159,7 @@ insert into cr_mime_types (label,mime_type,file_extension) values ( 'VRML' , 'x-world/x-vrml' , 'vrml'); insert into cr_mime_types (label,mime_type,file_extension) values ( 'Xuda' , 'xuda/gen-cert' , 'xuda'); insert into cr_mime_types (label,mime_type,file_extension) values ('Enhanced text' , 'text/enhanced' , 'etxt'); +insert into cr_mime_types (label,mime_type,file_extension) values ('Markdown text' , 'text/markdown' , 'mtxt'); insert into cr_mime_types (label,mime_type,file_extension) values ('Fixed-width text' , 'text/fixed-width' , 'ftxt'); insert into cr_mime_types (label,mime_type,file_extension) values ('OpenOffice Spreadsheet' , 'application/vnd.sun.xml.calc', 'sxc'); insert into cr_mime_types (label,mime_type,file_extension) values ('OpenOffice Spreadsheet Template', 'application/vnd.sun.xml.calc.template', 'stc'); Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.10.0d3-5.10.0d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.10.0d3-5.10.0d4.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.10.0d3-5.10.0d4.sql 29 Jan 2018 14:34:47 -0000 1.1 @@ -0,0 +1,4 @@ +-- +-- Minimal version (compared to postgres update), just adding the entry to cr_mime_types +-- +insert into cr_mime_types(label, mime_type, file_extension) values ('Markdown text', 'text/markdown', 'mtxt'); Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.10.0d3-5.10.0d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.10.0d3-5.10.0d4.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.10.0d3-5.10.0d4.sql 29 Jan 2018 14:34:47 -0000 1.1 @@ -0,0 +1,39 @@ +-- +-- Update mime types. +-- The changes have to be performed in a transaction, therefore the inline function. +-- +create or replace function inline_0 ( + p_label varchar, + p_extension varchar, + p_old_mime_type varchar, + p_new_mime_type varchar +) +returns integer as $$ +begin + SET CONSTRAINTS ALL DEFERRED; + 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; + + if exists (select 1 from cr_extension_mime_type_map where extension = p_extension) then + update cr_extension_mime_type_map set mime_type = p_new_mime_type where extension = p_extension; + else + 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); + end if; + + delete from cr_mime_types where mime_type = p_old_mime_type; + return 0; +end; +$$ language 'plpgsql'; + + +select inline_0('Markdown Text', 'mtxt', '', 'text/markdown'); + +drop function inline_0(varchar,varchar,varchar,varchar);