Permalink
Browse files

APC CSS and JS check.

  • Loading branch information...
davidstrauss authored and msonnabaum committed Feb 14, 2012
1 parent 86e6378 commit e2f9d2b10b4f0c5f61f120be145621913c6794a4
Showing with 11 additions and 2 deletions.
  1. +11 −2 includes/common.inc
View
@@ -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.
@@ -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.
*
@@ -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']) {

0 comments on commit e2f9d2b

Please sign in to comment.