Skip to content

Commit 6c9eed6

Browse files
committed
get subplugins folder back before removing them on or after the upgrade job
1 parent 046855b commit 6c9eed6

File tree

16 files changed

+877
-0
lines changed

16 files changed

+877
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
namespace lifecycletrigger_delayedcourses\privacy;
18+
19+
use core_privacy\local\metadata\null_provider;
20+
21+
/**
22+
* Privacy subsystem implementation for lifecycletrigger_delayedcourses.
23+
*
24+
* @package lifecycletrigger_delayedcourses
25+
* @copyright 2022 ISB Bayern
26+
* @author Philipp Memmel
27+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28+
*/
29+
class provider implements null_provider {
30+
31+
/**
32+
* Get the language string identifier with the component's language
33+
* file to explain why this plugin stores no data.
34+
*
35+
* @return string the reason
36+
*/
37+
public static function get_reason(): string {
38+
return 'privacy:metadata';
39+
}
40+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Install script for lifecycle subplugin
19+
*
20+
* @package lifecycletrigger_delayedcourses
21+
22+
* @copyright 2017 Tobias Reischmann WWU
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
use tool_lifecycle\local\manager\trigger_manager;
26+
27+
/**
28+
* Register delayed courses as initial workflow.
29+
*/
30+
function xmldb_lifecycletrigger_delayedcourses_install() {
31+
trigger_manager::register_workflow('delayedcourses');
32+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Lang strings for delayed course trigger
19+
*
20+
* @package lifecycletrigger_delayedcourses
21+
* @copyright 2017 Tobias Reischmann WWU
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
25+
$string['delay'] = 'Dieser Trigger wird alle Kurse ausschließen, die durch Nutzerinteraktion verzögert wurden.';
26+
$string['pluginname'] = 'Verzögerte Kurse ausschließen - Trigger';
27+
$string['privacy:metadata'] = 'Dieses Subplugin speichert keine persönlichen Daten.';
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Lang strings for delayed course trigger
19+
*
20+
* @package lifecycletrigger_delayedcourses
21+
* @copyright 2017 Tobias Reischmann WWU
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
25+
$string['delay'] = 'This module will exclude all courses, which were delayed by user interaction';
26+
$string['pluginname'] = 'Exclude delayed courses trigger';
27+
$string['privacy:metadata'] = 'This subplugin does not store any personal data.';
28+

trigger/delayedcourses/lib.php

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* Trigger subplugin to exclude delayed courses.
19+
*
20+
* @package lifecycletrigger_delayedcourses
21+
* @copyright 2017 Tobias Reischmann WWU
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
namespace tool_lifecycle\trigger;
25+
26+
use tool_lifecycle\local\response\trigger_response;
27+
use tool_lifecycle\local\manager\delayed_courses_manager;
28+
29+
defined('MOODLE_INTERNAL') || die();
30+
require_once(__DIR__ . '/../lib.php');
31+
32+
/**
33+
* Class which implements the basic methods necessary for a life cycle trigger subplugin
34+
* @package lifecycletrigger_delayedcourses
35+
* @copyright 2017 Tobias Reischmann WWU
36+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37+
*/
38+
class delayedcourses extends base_automatic {
39+
40+
41+
/**
42+
* Checks the course and returns a repsonse, which tells if the course should be further processed.
43+
* @param object $course Course to be processed.
44+
* @param int $triggerid Id of the trigger instance.
45+
* @return trigger_response
46+
*/
47+
public function check_course($course, $triggerid) {
48+
return trigger_response::exclude();
49+
}
50+
51+
/**
52+
* Return sql which excludes delayed courses.
53+
* @param int $triggerid Id of the trigger.
54+
* @return array A list containing the constructed sql fragment and an array of parameters.
55+
*/
56+
public function get_course_recordset_where($triggerid) {
57+
return delayed_courses_manager::get_course_delayed_wheresql();
58+
}
59+
60+
61+
/**
62+
* The return value should be equivalent with the name of the subplugin folder.
63+
* @return string technical name of the subplugin
64+
*/
65+
public function get_subpluginname() {
66+
return 'delayedcourses';
67+
}
68+
69+
/**
70+
* Has only one instance and results in a preset workflow.
71+
* @return bool
72+
*/
73+
public function has_multiple_instances() {
74+
return false;
75+
}
76+
77+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
/**
18+
* lifecycletrigger_delayedcourses generator tests
19+
*
20+
* @package lifecycletrigger_delayedcourses
21+
* @category test
22+
* @copyright 2018 Tobias Reischmann WWU
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
*/
25+
26+
use tool_lifecycle\local\entity\trigger_subplugin;
27+
use tool_lifecycle\local\entity\workflow;
28+
use tool_lifecycle\local\manager\trigger_manager;
29+
use tool_lifecycle\local\manager\workflow_manager;
30+
31+
/**
32+
* lifecycletrigger_delayedcourses generator tests
33+
*
34+
* @package lifecycletrigger_delayedcourses
35+
* @category test
36+
* @copyright 2018 Tobias Reischmann WWU
37+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38+
*/
39+
class tool_lifecycle_trigger_delayedcourses_generator extends testing_module_generator {
40+
41+
/**
42+
* Creates a trigger delayedcourses for an artificial workflow without steps.
43+
* @return trigger_subplugin the created delayedcourses trigger.
44+
*/
45+
public static function create_trigger_with_workflow() {
46+
// Create Workflow.
47+
$record = new stdClass();
48+
$record->id = null;
49+
$record->title = 'myworkflow';
50+
$workflow = workflow::from_record($record);
51+
workflow_manager::insert_or_update($workflow);
52+
// Create trigger.
53+
$record = new stdClass();
54+
$record->subpluginname = 'delayedcourses';
55+
$record->instancename = 'delayedcourses';
56+
$record->workflowid = $workflow->id;
57+
$trigger = trigger_subplugin::from_record($record);
58+
trigger_manager::insert_or_update($trigger);
59+
return $trigger;
60+
}
61+
62+
/**
63+
* Creates a workflow, which delays only for upcomming processes of itself.
64+
* @return workflow.
65+
*/
66+
public static function create_workflow() {
67+
// Create Workflow.
68+
$record = new stdClass();
69+
$record->id = null;
70+
$record->title = 'myworkflow';
71+
$record->rollbackdelay = 10000;
72+
$record->finishdelay = 10000;
73+
$record->delayforallworkflows = 0;
74+
$workflow = workflow::from_record($record);
75+
workflow_manager::insert_or_update($workflow);
76+
return $workflow;
77+
}
78+
79+
/**
80+
* Creates a workflow, which delays upcomming processes for all workflows.
81+
* @return workflow.
82+
*/
83+
public static function create_workflow_delaying_for_all_workflows() {
84+
// Create Workflow.
85+
$record = new stdClass();
86+
$record->id = null;
87+
$record->title = 'myworkflow';
88+
$record->rollbackdelay = 10000;
89+
$record->finishdelay = 10000;
90+
$record->delayforallworkflows = 1;
91+
$workflow = workflow::from_record($record);
92+
workflow_manager::insert_or_update($workflow);
93+
return $workflow;
94+
}
95+
}

0 commit comments

Comments
 (0)