You are here

function httprl_is_background_callback_capable in HTTP Parallel Request & Threading Library 7

Same name and namespace in other branches
  1. 6 httprl.module \httprl_is_background_callback_capable()

Sees if httprl can run a background callback.

Return value

Bool TRUE or FALSE.

4 calls to httprl_is_background_callback_capable()
httprl.examples.php in examples/httprl.examples.php
HTTP Parallel Request Library code examples.
httprl_call_user_func_array_async in ./httprl.module
Run the callback with the given params in the background.
httprl_call_user_func_array_cache in ./httprl.module
Cache a function; regenerate return value in the background.
httprl_queue_background_callback in ./httprl.module
Run callback in the background.

File

./httprl.module, line 3371
HTTP Parallel Request Library module.

Code

function httprl_is_background_callback_capable() {

  // Check if site is offline.
  if (defined('VERSION') && substr(VERSION, 0, 1) >= 7 && httprl_variable_get('maintenance_mode', 0) || httprl_variable_get('site_offline', 0)) {
    return FALSE;
  }

  // Check that the httprl_background_callback variable is enabled.
  if (!httprl_variable_get('httprl_background_callback', HTTPRL_BACKGROUND_CALLBACK)) {
    return FALSE;
  }

  // Check that the callback in menu works.
  if (httprl_drupal_full_bootstrap() && function_exists('menu_get_item') && !menu_get_item('httprl_async_function_callback')) {
    return FALSE;
  }

  // All checks passed.
  return TRUE;
}