Skip to content

Commit

Permalink
Show menu point when a manual or automatic workflow is active
Browse files Browse the repository at this point in the history
  • Loading branch information
justusdieckmann committed Feb 27, 2024
1 parent a1166ed commit 1ba261e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion classes/local/manager/workflow_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static function activate_workflow($workflowid) {
*/
private static function reset_manual_workflow_cache() {
$cache = \cache::make('tool_lifecycle', 'application');
$cache->delete('manualworkflowexists');
$cache->delete('workflowactive');
}

/**
Expand Down
10 changes: 5 additions & 5 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ function tool_lifecycle_extend_navigation_course($navigation, $course, $context)
}

$cache = cache::make('tool_lifecycle', 'application');
if ($cache->has('manualworkflowexists')) {
$manualwfexists = $cache->get('manualworkflowexists');
if ($cache->has('workflowactive')) {
$wfexists = $cache->get('workflowactive');
} else {
$manualwfexists = $DB->record_exists_select('tool_lifecycle_workflow', 'manual = 1 AND timeactive IS NOT NULL');
$cache->set('manualworkflowsexist', $manualwfexists);
$wfexists = $DB->record_exists_select('tool_lifecycle_workflow', 'timeactive IS NOT NULL');
$cache->set('workflowactive', $wfexists);
}

if (!$manualwfexists) {
if (!$wfexists) {
return null;
}

Expand Down

0 comments on commit 1ba261e

Please sign in to comment.