Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-tool_lifecycle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
2204bb39
Commit
2204bb39
authored
5 years ago
by
Justus Dieckmann
Committed by
Tobias Reischmann
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add task that cleans up old delays
parent
0158ff5c
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
classes/task/lifecycle_cleanup_task.php
+56
-0
56 additions, 0 deletions
classes/task/lifecycle_cleanup_task.php
db/tasks.php
+9
-0
9 additions, 0 deletions
db/tasks.php
lang/en/tool_lifecycle.php
+1
-0
1 addition, 0 deletions
lang/en/tool_lifecycle.php
version.php
+1
-1
1 addition, 1 deletion
version.php
with
67 additions
and
1 deletion
classes/task/lifecycle_cleanup_task.php
0 → 100644
+
56
−
0
View file @
2204bb39
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Scheduled task for cleanup past delays
*
* @package tool_lifecycle
* @copyright 2019 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace
tool_lifecycle\task
;
defined
(
'MOODLE_INTERNAL'
)
||
die
;
/**
* Scheduled task for cleanup past delays
*
* @package tool_lifecycle
* @copyright 2019 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
lifecycle_cleanup_task
extends
\core\task\scheduled_task
{
/**
* Get a descriptive name for this task (shown to admins).
*
* @return string
* @throws \coding_exception
*/
public
function
get_name
()
{
return
get_string
(
'lifecycle_cleanup_task'
,
'tool_lifecycle'
);
}
/**
* Do the job.
*/
public
function
execute
()
{
global
$DB
;
$twomonthago
=
time
()
-
60
*
24
*
60
*
60
;
$DB
->
delete_records_select
(
'tool_lifecycle_delayed'
,
'delayeduntil <= :time'
,
array
(
'time'
=>
$twomonthago
));
$DB
->
delete_records_select
(
'tool_lifecycle_delayed_workf'
,
'delayeduntil <= :time'
,
array
(
'time'
=>
$twomonthago
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
db/tasks.php
+
9
−
0
View file @
2204bb39
...
...
@@ -35,5 +35,14 @@ $tasks = array(
'month'
=>
'*'
,
'dayofweek'
=>
'*'
,
'faildelay'
=>
1
,
),
array
(
'classname'
=>
'tool_lifecycle\task\lifecycle_cleanup_task'
,
'blocking'
=>
0
,
'minute'
=>
'0'
,
'hour'
=>
'4'
,
'day'
=>
'*'
,
'month'
=>
'*'
,
'dayofweek'
=>
'0'
,
)
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lang/en/tool_lifecycle.php
+
1
−
0
View file @
2204bb39
...
...
@@ -60,6 +60,7 @@ $string['cannot_trigger_workflow_manually'] = 'The requested workflow could not
$string
[
'error_wrong_trigger_selected'
]
=
'You tried to request a non-manual trigger.'
;
$string
[
'lifecycle_task'
]
=
'Run the life cycle processes'
;
$string
[
'lifecycle_cleanup_task'
]
=
'Runs the life cycle cleanup'
;
$string
[
'trigger_subpluginname'
]
=
'Subplugin name'
;
$string
[
'trigger_subpluginname_help'
]
=
'Step subplugin/trigger title (visible for admins only).'
;
...
...
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
2204bb39
...
...
@@ -25,7 +25,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
;
$plugin
->
maturity
=
MATURITY_BETA
;
$plugin
->
version
=
201910
29
00
;
$plugin
->
version
=
201910
31
00
;
$plugin
->
component
=
'tool_lifecycle'
;
$plugin
->
requires
=
2017111300
;
// Require Moodle 3.4 (or above).
$plugin
->
release
=
'v3.7-r1'
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment