Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APC CSS and JS check. #16

Merged
merged 2 commits into from Aug 21, 2012
Merged
Changes from all commits
Commits
File filter
Filter file types
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -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,20 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro
drupal_add_js($settings, 'setting');
}

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

/**
* Aggregates JavaScript files into a cache file in the files directory.
*
@@ -4809,7 +4823,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']) {
ProTip! Use n and p to navigate between commits in a pull request.