Skip to content

Commit

Permalink
add a session keep alive iframe for long running processes
Browse files Browse the repository at this point in the history
Possible fix for #48
  • Loading branch information
Syxton committed Oct 4, 2023
1 parent 18af3e1 commit 8257d0f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions step4.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
require_once($CFG->libdir . '/adminlib.php');

header('X-Accel-Buffering: no');
header('Content-Encoding: identity');

require_login();
admin_externalpage_setup('toolcoursearchiver');
Expand Down Expand Up @@ -120,11 +121,18 @@
$returnurl = new moodle_url('/admin/tool/coursearchiver/step2.php');
redirect($returnurl);
}

$processor = new tool_coursearchiver_processor(array("mode" => $mode, "data" => $courses));
if (!empty($folder)) {
$processor->folder = $folder;
}

// Automatic refreshing iframe to keep sessions alive during long script execution.
echo '<iframe style="display:none" src="' . $CFG->wwwroot . '/admin/tool/coursearchiver/keepalive.php"></iframe>';

// Execute process.
$processor->execute(tool_coursearchiver_tracker::OUTPUT_HTML, null);

echo $OUTPUT->footer();
break;
default:
Expand Down

0 comments on commit 8257d0f

Please sign in to comment.