Commit a5cf7d59 authored by Son Nguyen's avatar Son Nguyen
Browse files

Enable more media formats. Bug #1564706

- OGG
- WEBM
- 3GPP

behatnotneeded

Change-Id: I8a07f46ad11fd4b781679d9e0a76a653e0c60abb
parent 8e4a1f64
......@@ -40,7 +40,7 @@ class PluginBlocktypeInternalmedia extends MaharaCoreBlocktype {
public static function postinst($oldversion) {
if ($oldversion == 0) {
set_config_plugin('blocktype', 'internalmedia', 'enabledtypes', serialize(array('flv', 'mp3', 'mp4_video')));
set_config_plugin('blocktype', 'internalmedia', 'enabledtypes', serialize(array('flv', 'mp3', 'mp4')));
}
}
......@@ -258,9 +258,12 @@ class PluginBlocktypeInternalmedia extends MaharaCoreBlocktype {
'wmv' => 'wmp',
'mpeg' => 'qt',
'avi' => 'wmp',
'mp4_video' => 'html5video',
'mp4' => 'html5video',
'oga' => 'html5audio',
'ogg' => 'html5audio',
'ogv' => 'html5video',
'webm' => 'html5video',
'3gp' => 'html5video',
/* commenting out for now
'ram' => 'real_player',
'rm' => 'real_player',
......
......@@ -442,5 +442,33 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
}
}
if ($oldversion < 2016082900) {
log_debug('Drop the old primary key constraint and add new id column from/to the table artefact_file_mime_types');
if (is_postgres()) {
execute_sql('ALTER TABLE {artefact_file_mime_types}
DROP CONSTRAINT IF EXISTS artefilemimetype_mim_pk,
ADD COLUMN id SERIAL PRIMARY KEY');
}
else if (is_mysql()) {
execute_sql('ALTER TABLE {artefact_file_mime_types}
DROP PRIMARY KEY,
ADD id INT AUTO_INCREMENT NOT NULL,
ADD PRIMARY KEY ( id )');
}
log_debug('Update MIME types for more media files');
// 1. OGG See more https://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
ensure_record_exists('artefact_file_mime_types', (object) array('mimetype' => 'audio/ogg'), (object) array('mimetype' => 'audio/ogg', 'description' => 'ogg'));
ensure_record_exists('artefact_file_mime_types', (object) array('mimetype' => 'audio/ogg'), (object) array('mimetype' => 'audio/ogg', 'description' => 'oga'));
ensure_record_exists('artefact_file_mime_types', (object) array('mimetype' => 'video/ogg'), (object) array('mimetype' => 'video/ogg', 'description' => 'ogv'));
// 2. 3GPP - https://en.wikipedia.org/wiki/3GP_and_3G2
ensure_record_exists('artefact_file_mime_types', (object) array('mimetype' => 'audio/3gpp'), (object) array('mimetype' => 'audio/3gpp', 'description' => '3gp'));
ensure_record_exists('artefact_file_mime_types', (object) array('mimetype' => 'video/3gpp'), (object) array('mimetype' => 'video/3gpp', 'description' => '3gp'));
log_debug('Add an index of mimetype to the table artefact_file_mime_types');
execute_sql('CREATE INDEX mimetypeix ON {artefact_file_mime_types} (mimetype)');
}
return $status;
}
......@@ -157,7 +157,37 @@
</mimetypes>
</filetype>
<filetype>
<description>mp4_video</description>
<description>mp4</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4a</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4p</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4b</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4r</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>m4v</description>
<mimetypes>
<mimetype>video/mp4</mimetype>
</mimetypes>
......@@ -215,12 +245,6 @@
<mimetype>audio/mpeg</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>mp4_audio</description>
<mimetypes>
<mimetype>audio/mp4</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>ra</description>
<mimetypes>
......@@ -534,6 +558,12 @@
<mimetype>video/ogg</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>ogg</description>
<mimetypes>
<mimetype>audio/ogg</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>pct</description>
<mimetypes>
......@@ -762,5 +792,17 @@
<mimetype>application/xml</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>3gp</description>
<mimetypes>
<mimetype>audio/3gpp</mimetype>
</mimetypes>
</filetype>
<filetype>
<description>3gp</description>
<mimetypes>
<mimetype>video/3gpp</mimetype>
</mimetypes>
</filetype>
</filetypes>
......@@ -215,8 +215,7 @@ $string['js'] = 'Javascript file';
$string['latex'] = 'LaTeX document';
$string['m3u'] = 'M3U audio file';
$string['mp3'] = 'MP3 audio file';
$string['mp4_audio'] = 'MP4 audio file';
$string['mp4_video'] = 'MP4 video file';
$string['mp4'] = 'MP4 media file';
$string['mpeg'] = 'MPEG movie';
$string['odb'] = 'OpenOffice / LibreOffice Base database file';
$string['odc'] = 'OpenOffice / LibreOffice Calc file';
......@@ -231,6 +230,7 @@ $string['oth'] = 'OpenOffice / LibreOffice web document';
$string['ott'] = 'OpenOffice / LibreOffice template document';
$string['oga'] = 'OGA audio file';
$string['ogv'] = 'OGV video file';
$string['ogg'] = 'OGG Vorbis audio file';
$string['pdf'] = 'PDF document';
$string['png'] = 'PNG image';
$string['ppt'] = 'MS PowerPoint document';
......@@ -255,6 +255,8 @@ $string['mpg'] = 'MPG movie';
$string['ram'] = 'RAM RealPlayer movie';
$string['rpm'] = 'RPM RealPlayer movie';
$string['rm'] = 'RM RealPlayer movie';
$string['webm'] = 'WEBM video file';
$string['3gp'] = '3GPP media file';
// Profile icons
......
......@@ -2801,9 +2801,11 @@ class ArtefactTypeVideo extends ArtefactTypeFile {
'wmv' => 'wmv',
'quicktime' => 'quicktime',
'sgi_movie' => 'sgi_movie',
'mp4_video' => 'mp4_video',
'asf' => 'wmv',
'ogv' => 'ogv',
'mp4' => 'mp4',
'3gp' => '3gp',
'webm' => 'webm',
);
}
return $descriptions;
......@@ -2851,7 +2853,6 @@ class ArtefactTypeAudio extends ArtefactTypeFile {
if (is_null($descriptions)) {
$descriptions = array(
'mp3',
'mp4_audio',
'mp4',
'wav',
'ra',
......@@ -2860,6 +2861,7 @@ class ArtefactTypeAudio extends ArtefactTypeFile {
'm3u',
'asf',
'oga',
'ogg',
);
}
return $descriptions;
......
......@@ -12,6 +12,6 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2015101900;
$config->release = '1.2.5';
$config->version = 2016082900;
$config->release = '1.2.6';
......@@ -365,7 +365,7 @@ class Pieform {/*{{{*/
// Check that all elements have names compliant to PHP's variable naming policy
// (otherwise things get messy later)
foreach (array_keys($this->elementrefs) as $name) {
if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $name)) {
if (!preg_match('/^[a-zA-Z0-9_][a-zA-Z0-9_]*$/', $name)) {
throw new PieformException('Element "' . $name . '" is badly named (validity test: could you give a PHP variable the name?)');
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment