Skip to content

Commit 0afaac6

Browse files
authored
Completely remove subtiltes workflow, Correctly update workflows if tags changed (#1215)
* Completely remove subtiltes workflow * remove non existent workflows * rename migration
1 parent 2238a28 commit 0afaac6

File tree

6 files changed

+34
-11
lines changed

6 files changed

+34
-11
lines changed

INSTALL.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ org.opencastproject.userdirectory.studip.cache.expiration=1
7272

7373
Make sure to change the token and add that token to the Opencast config in Stud.IP. Furthermore configure the Opencast-Plugin in Stud.IP to have the `nobody` role for it to work.
7474

75-
6. Recommended for Opencast Version >= 17, edit `/etc/opencast/custom.properties` and enable:
75+
6. Recommended for Opencast Version >= 17, edit `/etc/opencast/custom.properties` and enable:
7676

7777
```
7878
# Allow episode ID based access control via roles.
@@ -121,9 +121,6 @@ You can configure which workflow is used for different actions. They can be edit
121121
| upload | Workflow run after uploading a video | upload |
122122
| studio | Workflow run after creating a video OC Studio | upload |
123123
| delete | Workflow run when a video shall be deleted permanently | delete |
124-
| subtiltes | Workflow run after a subtitle has been added or removed | archive |
125-
126-
The subtitles-Workflow needs to make sure that the changes are published, otherwise the subtitles will not be visible.
127124

128125
## Credentials for Opencast
129126

lib/Models/Workflow.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ public static function updateWorkflowsByConfigId($config_id) {
3232

3333
foreach ($wf_defs as $wf_def) {
3434
$found = false;
35-
foreach ($db_workflows as $db_workflow) {
35+
foreach ($db_workflows as $key => $db_workflow) {
3636
if ($db_workflow['name'] === $wf_def['id'] && $db_workflow['tag'] === $wf_def['tag']) {
3737
$entry = self::findOneBySql('config_id = ? AND name = ? AND tag = ?', [$config_id, $wf_def['id'], $wf_def['tag']]);
3838
$entry->setValue('displayname', $wf_def['title']);
3939
$entry->store();
4040

4141
$found = true;
42+
unset($db_workflows[$key]);
4243
break;
4344
}
4445
}
@@ -60,6 +61,11 @@ public static function updateWorkflowsByConfigId($config_id) {
6061
}
6162
} catch (\Throwable $th) {
6263
}
64+
65+
// the remaining entries or workflow - tag combinations that are not there anymore and need to be deleted from Stud.IP
66+
foreach ($db_workflows as $db_workflow) {
67+
$db_workflow->delete();
68+
}
6369
}
6470

6571
public function sanitizeSettings($event)

lib/Models/WorkflowConfig.php

-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ public static function createAndUpdateByConfigId($config_id, $workflows = null)
6161
case 'studio';
6262
$type = 'upload';
6363
break;
64-
65-
case 'subtitles';
66-
$type = 'archive';
67-
break;
6864
}
6965

7066
$workflow_id = isset($workflows[$entry->id])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
class RemoveSubtitlesWorkflow extends Migration
4+
{
5+
public function description()
6+
{
7+
return 'Remove "editor" from list of configurable workflows';
8+
}
9+
10+
public function up()
11+
{
12+
$db = DBManager::get();
13+
14+
$db->exec("ALTER TABLE `oc_workflow_config`
15+
MODIFY `used_for` enum('schedule','upload','studio','delete') CHARACTER SET latin1 COLLATE latin1_bin
16+
");
17+
18+
$db->exec("DELETE FROM `oc_workflow_config` WHERE `used_for` NOT IN ('schedule','upload','studio','delete')");
19+
20+
SimpleOrMap::expireTableScheme();
21+
}
22+
23+
public function down()
24+
{
25+
}
26+
}

tools/ansible-testsystem/studip-demo/roles/cleaner/templates/oc.sql

-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,5 @@ REPLACE INTO `oc_workflow_config` (`id`, `config_id`, `used_for`, `workflow_id`)
162162
(2, 1, 'upload', 6),
163163
(3, 1, 'studio', 6),
164164
(4, 1, 'delete', 1),
165-
(5, 1, 'subtitles', 9);
166165

167166
SET FOREIGN_KEY_CHECKS=1;

vueapp/components/Config/WorkflowOptions.vue

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export default {
4343
(
4444
wf['tag'] === wf_conf['used_for']
4545
|| wf['tag'] === 'upload' && wf_conf['used_for'] === 'studio'
46-
|| wf['tag'] === 'archive' && wf_conf['used_for'] === 'subtitles'
4746
)
4847
) {
4948
options.push({

0 commit comments

Comments
 (0)