You are here

function boost_has_site_changed in Boost 6

Checks various timestamps in the database.

Parameters

$set_max: bool Allow one to read and not set the max_timestamp.

Return value

bool Returns TRUE if the site has changed since the last time this function was called.

2 calls to boost_has_site_changed()
boost_block in ./boost.module
Implementation of hook_block().
boost_cron in ./boost.module
Implementation of hook_cron(). Performs periodic actions.

File

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

Code

function boost_has_site_changed($set_max = FALSE) {

  // Make sure database has been indexed.
  if (boost_drupal_get_installed_schema_version('boost') <= 6120) {
    return FALSE;
  }

  // Index any new tables
  $ret = array();
  _boost_index_exists($ret, 'node_revisions', 'timestamp');
  _boost_index_exists($ret, 'files', 'timestamp');
  _boost_index_exists($ret, 'comments', 'timestamp');
  _boost_index_exists($ret, 'node', 'changed');
  _boost_index_exists($ret, 'node_comment_statistics', 'last_comment_timestamp');
  _boost_index_exists($ret, 'votingapi_vote', 'timestamp');

  // Get timestamps from the database
  $node_revisions = boost_get_time('node_revisions', 'timestamp');

  //$history = boost_get_time('history', 'timestamp');
  $files = boost_get_time('files', 'timestamp');
  $comments = boost_get_time('comments', 'timestamp');
  $voteapi_vote = boost_get_time('votingapi_vote', 'timestamp');
  $node = boost_get_time('node', 'changed');
  $last_comment_timestamp = boost_get_time('node_comment_statistics', 'last_comment_timestamp');
  $max = max($node_revisions, $files, $comments, $node, $last_comment_timestamp, $voteapi_vote);
  if ($max != variable_get('boost_max_timestamp', BOOST_TIME)) {
    if ($set_max) {
      variable_set('boost_max_timestamp', (int) $max);
    }
    return TRUE;
  }
  else {
    return FALSE;
  }
}