hypejunction/hypeshutdown

Flushes the buffer after the response is sent allowing shutdown to continue in the background


Keywords
plugin, shutdown, elgg
License
GPL-2.0-only

Documentation

hypeShutdown

API to offset code execution until system shutdown. Allows plugins to execute expensive code until after the page has been rendered in the browser.

Usage

All shutdown event handlers will be executed after the request has been sent to the browser and the buffer has been flushed.

You can either register a shutdown event handler:

elgg_register_event_handler('shutdown', 'system', function() {
	// your long running script
});

You can also use a runtime queue:

\hypeJunction\Shutdown\Queue::instance()->queue(function() use ($video) {
	$video->convert();
});