function advagg_update_atime

cis7 advagg.module advagg_update_atime($aggregate_filenames_hash, $aggregate_contents_hash)
cle7 advagg.module advagg_update_atime($aggregate_filenames_hash, $aggregate_contents_hash)
elmsmedia7 advagg.module advagg_update_atime($aggregate_filenames_hash, $aggregate_contents_hash)
icor7 advagg.module advagg_update_atime($aggregate_filenames_hash, $aggregate_contents_hash)
meedjum_blog7 advagg.module advagg_update_atime($aggregate_filenames_hash, $aggregate_contents_hash)
mooc7 advagg.module advagg_update_atime($aggregate_filenames_hash, $aggregate_contents_hash)

Update the atime value in the advagg_aggregates_versions table.

Parameters

string $aggregate_filenames_hash: Hash of the groupings of files.

string $aggregate_contents_hash: Hash of the files contents.

Return value

bool TRUE if a write to the DB was done.

2 calls to advagg_update_atime()
advagg_missing_create_file in sites/all/modules/ulmus/advagg/advagg.missing.inc
Given a filename create that file.
advagg_update_all_atimes in sites/all/modules/ulmus/advagg/advagg.inc
Update atime advagg_aggregates_versions table & cache_advagg_info cache bin.

File

sites/all/modules/ulmus/advagg/advagg.module, line 1935
Advanced CSS/JS aggregation module.

Code

function advagg_update_atime($aggregate_filenames_hash, $aggregate_contents_hash) {
  $write_done = FALSE;
  // Set the cache id.
  $cache_id = 'advagg:db:' . $aggregate_filenames_hash . ADVAGG_SPACE . $aggregate_contents_hash;
  // Set db record.
  $record = array(
    'aggregate_filenames_hash' => $aggregate_filenames_hash,
    'aggregate_contents_hash' => $aggregate_contents_hash,
    'atime' => REQUEST_TIME,
  );

  // Use the cache to avoid hitting the database.
  $cache = cache_get($cache_id, 'cache_advagg_info');
  if ($cache) {
    // See if the atime value needs to be updated;
    if (!empty($cache->data['atime']) && $cache->data['atime'] > REQUEST_TIME - (12 * 60 * 60)) {
      // If atime is less than 12 hours old, do nothing.
      return $write_done;
    }
  }

  // If lock is already acquired, return here.
  if (!lock_acquire($cache_id, 5)) {
    return $write_done;
  }

  // Update atime in DB.
  if (drupal_write_record('advagg_aggregates_versions', $record, array('aggregate_filenames_hash', 'aggregate_contents_hash'))) {
    $write_done = TRUE;
  }

  // Update the atime in the cache.
  // Get fresh copy of the cache now that we are in a lock.
  $cache = cache_get($cache_id, 'cache_advagg_info');
  // Set the atime.
  if (empty($cache->data)) {
    $cache = new stdClass();
  }
  $cache->data['atime'] = REQUEST_TIME;

  // Write to the cache.
  cache_set($cache_id, $cache->data, 'cache_advagg_info', CACHE_PERMANENT);

  // Release Lock.
  lock_release($cache_id);

  // Return if a write was done.
  return $write_done;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.