Skip to content

Commit e2f9d2b

Browse files
davidstraussmsonnabaum
authored andcommitted
APC CSS and JS check.
1 parent 86e6378 commit e2f9d2b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

includes/common.inc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,7 +3448,7 @@ function drupal_build_css_cache($css) {
34483448
$uri = $map[$key];
34493449
}
34503450

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

4779+
function drupal_aggregated_file_exists($uri) {
4780+
$exists = apc_exists('file_exists_' . $uri);
4781+
if (!$exists && file_exists($uri)) {
4782+
$exists = TRUE;
4783+
apc_store('file_exists_' . $uri, TRUE, 86400);
4784+
}
4785+
return $exists;
4786+
}
4787+
47794788
/**
47804789
* Aggregates JavaScript files into a cache file in the files directory.
47814790
*
@@ -4809,7 +4818,7 @@ function drupal_build_js_cache($files) {
48094818
$uri = $map[$key];
48104819
}
48114820

4812-
if (empty($uri) || !file_exists($uri)) {
4821+
if (empty($uri) || !drupal_aggregated_file_exists($uri)) {
48134822
// Build aggregate JS file.
48144823
foreach ($files as $path => $info) {
48154824
if ($info['preprocess']) {

0 commit comments

Comments
 (0)