Skip to content

Commit

Permalink
APC CSS and JS check.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidstrauss authored and msonnabaum committed Mar 24, 2012
1 parent 86e6378 commit e2f9d2b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions includes/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3448,7 +3448,7 @@ function drupal_build_css_cache($css) {
$uri = $map[$key];
}

if (empty($uri) || !file_exists($uri)) {
if (empty($uri) || !drupal_aggregated_file_exists($uri)) {
// Build aggregate CSS file.
foreach ($css as $stylesheet) {
// Only 'file' stylesheets can be aggregated.
Expand Down Expand Up @@ -4776,6 +4776,15 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro
drupal_add_js($settings, 'setting');
}

function drupal_aggregated_file_exists($uri) {
$exists = apc_exists('file_exists_' . $uri);
if (!$exists && file_exists($uri)) {
$exists = TRUE;
apc_store('file_exists_' . $uri, TRUE, 86400);
}
return $exists;
}

/**
* Aggregates JavaScript files into a cache file in the files directory.
*
Expand Down Expand Up @@ -4809,7 +4818,7 @@ function drupal_build_js_cache($files) {
$uri = $map[$key];
}

if (empty($uri) || !file_exists($uri)) {
if (empty($uri) || !drupal_aggregated_file_exists($uri)) {
// Build aggregate JS file.
foreach ($files as $path => $info) {
if ($info['preprocess']) {
Expand Down

0 comments on commit e2f9d2b

Please sign in to comment.