From 319761ed2fcbfaf55d20d1874591d52e456abd87 Mon Sep 17 00:00:00 2001 From: NinaHerrmann Date: Wed, 22 Nov 2023 15:59:25 +0100 Subject: [PATCH 1/2] running cbf and increasing version number --- db/access.php | 14 +++++++------- db/install.php | 2 +- lib.php | 22 +++++++++++----------- tests/repository_opencast_test.php | 9 +++++++-- version.php | 14 +++++++------- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/db/access.php b/db/access.php index dd93e47..e73ca5f 100644 --- a/db/access.php +++ b/db/access.php @@ -25,15 +25,15 @@ defined('MOODLE_INTERNAL') || die(); -$capabilities = array( - 'repository/opencast:view' => array( +$capabilities = [ + 'repository/opencast:view' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_MODULE, - 'archetypes' => array( + 'archetypes' => [ 'coursecreator' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ) - ) -); + 'manager' => CAP_ALLOW, + ], + ], +]; diff --git a/db/install.php b/db/install.php index 1031886..74a84b5 100644 --- a/db/install.php +++ b/db/install.php @@ -33,7 +33,7 @@ function xmldb_repository_opencast_install() { $result = true; require_once($CFG->dirroot . '/repository/lib.php'); - $opencastplugin = new repository_type('opencast', array(), true); + $opencastplugin = new repository_type('opencast', [], true); if (!$id = $opencastplugin->create(true)) { $result = false; diff --git a/lib.php b/lib.php index a895af7..75e0dee 100644 --- a/lib.php +++ b/lib.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/repository/lib.php'); -use \tool_opencast\local\api; +use tool_opencast\local\api; /** * repository_opencast class is used to browse opencast files @@ -50,7 +50,7 @@ public static function instance_config_form($mform) { return false; } - $options = array(); + $options = []; foreach (\tool_opencast\local\settings_api::get_ocinstances() as $ocinstance) { $options[$ocinstance->id] = $ocinstance->name; } @@ -89,7 +89,7 @@ public static function instance_config_form($mform) { * @param array $options settings * @return bool */ - public function set_option($options = array()) { + public function set_option($options = []) { $options['opencast_instance'] = clean_param($options['opencast_instance'], PARAM_INT); $options['opencast_author'] = clean_param($options['opencast_author'], PARAM_TEXT); $options['opencast_channelid'] = clean_param($options['opencast_channelid'], PARAM_TEXT); @@ -107,7 +107,7 @@ public function set_option($options = array()) { * @return array */ public static function get_instance_option_names() { - $instanceoptions = array(); + $instanceoptions = []; $instanceoptions[] = 'opencast_instance'; $instanceoptions[] = 'opencast_author'; $instanceoptions[] = 'opencast_channelid'; @@ -289,10 +289,10 @@ private function get_course_videos($courseid) { // Get all videos from all series. $ocinstanceid = $this->get_ocinstance(); - $videos = array(); + $videos = []; - foreach (\tool_opencast\seriesmapping::get_records(array('courseid' => $courseid, - 'ocinstanceid' => $ocinstanceid)) as $mapping) { + foreach (\tool_opencast\seriesmapping::get_records(['courseid' => $courseid, + 'ocinstanceid' => $ocinstanceid, ]) as $mapping) { if (!$mapping || !($seriesid = $mapping->get('series'))) { continue; } @@ -334,14 +334,14 @@ public function get_listing($encodedpath = '', $page = '') { $videos = $this->get_course_videos($course->id); - $ret = array(); + $ret = []; $ret['dynload'] = false; $ret['nosearch'] = true; $ret['nologin'] = true; - $ret['list'] = array(); + $ret['list'] = []; foreach ($videos as $video) { - $listitem = array(); + $listitem = []; $listitem['title'] = $video->title; if (!file_extension_in_typegroup($video->title, $this->supported_filetypes())) { $listitem['title'] = $video->title . '.mp4'; @@ -370,7 +370,7 @@ public function supported_returntypes() { * @return string[] */ public function supported_filetypes() { - return array('video'); + return ['video']; } /** diff --git a/tests/repository_opencast_test.php b/tests/repository_opencast_test.php index eebedef..4fe255d 100644 --- a/tests/repository_opencast_test.php +++ b/tests/repository_opencast_test.php @@ -31,6 +31,11 @@ */ class repository_opencast_test extends advanced_testcase { + /** + * Test creation of instance... + * + * @covers \repository_opencast\lib.php + */ public function test_add_video_published_data() { global $CFG; @@ -49,7 +54,7 @@ public function test_add_video_published_data() { 'opencast_thumbnailflavor' => 'presenter/search+preview', 'opencast_thumbnailflavorfallback' => 'presentation/search+preview', 'opencast_videoflavor' => 'delivery/h264-720p', - 'opencast_playerurl' => '' + 'opencast_playerurl' => '', ]); $repository = new repository_opencast($instance->id); @@ -71,7 +76,7 @@ public function test_add_video_published_data() { 'opencast_thumbnailflavor' => 'notvalid', 'opencast_thumbnailflavorfallback' => 'presentation/search+preview', 'opencast_videoflavor' => 'delivery/h264-720p', - 'opencast_playerurl' => '' + 'opencast_playerurl' => '', ]); $repository = new repository_opencast($instance->id); diff --git a/version.php b/version.php index e822eea..560b1e9 100644 --- a/version.php +++ b/version.php @@ -26,10 +26,10 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'repository_opencast'; -$plugin->release = 'development-version'; -$plugin->version = 2023030100; -$plugin->requires = 2020061500; // Requires Moodle 3.9+. -$plugin->maturity = MATURITY_ALPHA; -$plugin->dependencies = array( - 'tool_opencast' => 2023030100 -); +$plugin->release = 'v4.3-r1'; +$plugin->version = 2023112200; +$plugin->requires = 2022112800; // Requires Moodle 4.1+. +$plugin->maturity = MATURITY_STABLE; +$plugin->dependencies = [ + 'tool_opencast' => 2023112200, +]; From 33bfeecec31a0e1343fc1af692b982cd56c7c8c7 Mon Sep 17 00:00:00 2001 From: NinaHerrmann Date: Wed, 22 Nov 2023 21:33:59 +0100 Subject: [PATCH 2/2] chaneg back to support 3.9+ --- version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.php b/version.php index 560b1e9..79e05ac 100644 --- a/version.php +++ b/version.php @@ -28,7 +28,7 @@ $plugin->component = 'repository_opencast'; $plugin->release = 'v4.3-r1'; $plugin->version = 2023112200; -$plugin->requires = 2022112800; // Requires Moodle 4.1+. +$plugin->requires = 2020061524; // Requires Moodle 3.9+. $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ 'tool_opencast' => 2023112200,