MDL-73734 tool_httpreplace: Use streaming output api

This commit is contained in:
Brendan Heywood 2023-06-12 09:49:34 +10:00
parent d5860ac566
commit 9a8fccbabc
2 changed files with 9 additions and 1 deletions

View File

@ -151,6 +151,7 @@ class url_finder {
sort($tables); // Make it easier to see progress because they are ordered.
$numberoftables = count($tables);
$tablenumber = 0;
sort($tables);
foreach ($tables as $table) {
if ($progress) {
$progress->update($tablenumber, $numberoftables, get_string('searching', 'tool_httpsreplace', $table));

View File

@ -58,6 +58,14 @@ $finder = new \tool_httpsreplace\url_finder();
$PAGE->set_cacheable(false);
$progressbar = new progress_bar();
// Preemptively reset the navcache before closing, so it remains the same on shutdown.
navigation_cache::destroy_volatile_caches();
\core\session\manager::write_close();
// Prepare for streamed output.
echo $OUTPUT->footer();
echo $OUTPUT->select_element_for_append();
if (!$data = $form->get_data()) {
echo $progressbar->create();
@ -103,4 +111,3 @@ if (!$data = $form->get_data()) {
echo $OUTPUT->continue_button(new moodle_url('/admin/settings.php', ['section' => 'httpsecurity']));
}
echo $OUTPUT->footer();