You are here

function boost_views_async in Boost 6

Run views looking for new nodes.

1 string reference to 'boost_views_async'
boost_menu in ./boost.module
Implementation of hook_menu().

File

./boost.module, line 1271
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_views_async() {

  // Exit if no nodes
  if (empty($_GET['new_nodes']) || !is_array($_GET['new_nodes'])) {
    return;
  }

  // Exit if key does not match.
  if (!empty($_GET['key'])) {
    $key = variable_get('boost_crawler_key', FALSE);
    if ($key == $_GET['key']) {

      // Break connection so processing is async. Return key.
      boost_async_opp($_GET['key']);

      // Give us lots of ram
      $m_limit = ini_get('memory_limit');
      $m_limit_int = substr($m_limit, 0, -1);
      $m_limit_int = (int) $m_limit_int;
      $m_limit_scale = strtoupper(substr($m_limit, -1));
      if ($m_limit_scale == 'M' && $m_limit_int < 256) {
        @ini_set('memory_limit', $m_limit_int * 4 . 'M');
      }

      // Give us lots of time
      $t_limit = ini_get('max_execution_time');
      @ini_set('max_execution_time', $t_limit * 4);
    }
    else {
      return;
    }
  }
  else {
    return;
  }

  // Get list of nodes to process.
  global $_boost;
  $_boost['new_nodes'] = $_GET['new_nodes'];

  // Process list.
  $data = _boost_views_runit();

  // Set ini variables back
  if (isset($m_limit)) {
    @ini_set('memory_limit', $m_limit);
  }
  if (isset($t_limit)) {
    @ini_set('max_execution_time', $t_limit);
  }
  return $data;
}