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 Oct 26, 2023
1 parent dbfad48 commit e2e6d0b
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 @@ -615,7 +615,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 @@ -630,7 +630,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 e2e6d0b

Please sign in to comment.