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 -N
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ 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
@@ -0,0 +1,35 @@
+--
+-- 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 = 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('Javascript','js','application/x-javascript','application/javascript') from dual;
+select inline_0('JSON','json','-- dummy --','application/json') from dual;
+
+drop function inline_0;
