Skip to content

Commit

Permalink
Fix 'A lock was created but not released at' error?
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Dec 10, 2023
1 parent c60f847 commit 3fd3e5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ private static function update_the_displayed_images($courseid = null) {
if (!empty($coursesectionimages)) {
$fs = get_file_storage();
$lockfactory = null;
$lock = true;
$lock = null;
if (!defined('BEHAT_SITE_RUNNING')) {
$lockfactory = \core\lock\lock_config::get_lock_factory('format_grid');
}
Expand All @@ -693,7 +693,7 @@ private static function update_the_displayed_images($courseid = null) {
if (!defined('BEHAT_SITE_RUNNING')) {
$lock = $lockfactory->get_lock('sectionid' . $coursesectionimage->sectionid, 5);
}
if ($lock) {
if (($lock instanceof \core\lock\lock) || (defined('BEHAT_SITE_RUNNING'))) {
$files = $fs->get_area_files($coursecontext->id, 'format_grid', 'sectionimage', $coursesectionimage->sectionid);
foreach ($files as $file) {
if (!$file->is_directory()) {
Expand Down

0 comments on commit 3fd3e5c

Please sign in to comment.