Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296586

Use drupal_register_shutdown_function() in a really unique way OR allow for alt call to call_user_func_array() in _drupal_shutdown_function()

$
0
0

Looking to do some unique things with drupal_register_shutdown_function. #2222635: Waiting for table metadata lock on cache_field table& #1599622: Run poormanscron via a non-blocking HTTP request are the motivation; run tasks that take a long time in a background request and let contrib (https://drupal.org/project/background_process, https://drupal.org/project/httprl/) handle it.

I'm thinking of doing something like this in hook_exit to capture the shutdown calls.

$callbacks = &drupal_register_shutdown_function();
// Modify $callbacks here.

The other option would be to modify _drupal_shutdown_function so an alternative to call_user_func_array can be used.

  try {
    $function = \Drupal::config('system.site')->get('drupal_shutdown_function');
    while (list($key, $callback) = each($callbacks)) {
      $function($callback['callback'], $callback['arguments']);
    }
  }

Viewing all articles
Browse latest Browse all 296586

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>