pantheon-systems / drops-7

Pantheon Upstream for Drupal 7 Sites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Drupal 7.79 not applied to drops-7 correctly

greg-1-anderson opened this issue · comments

There were two minor omissions to the 7.79 release due to a problem with applying the patch.

  • menu.inc is missing a change to a comment (no difference in behavior)
  • common.inc is missing a minor bug fix (will not cause problems for sites, beyond missing out on the fix)

The diff between the drops-7 common.inc and Drupal's common.inc is as follows:

--- includes/common.inc	2021-04-08 08:05:07.000000000 -0700
+++ /Users/ga/Code/open-source/drupal/drupal-7/includes/common.inc	2021-04-08 08:37:01.000000000 -0700
@@ -3676,7 +3676,7 @@ function drupal_build_css_cache($css) {
     $uri = $map[$key];
   }
 
-  if (empty($uri) || !drupal_aggregated_file_exists($uri)) {
+  if (empty($uri) || !file_exists($uri)) {
     // Build aggregate CSS file.
     foreach ($css as $stylesheet) {
       // Only 'file' stylesheets can be aggregated.
@@ -5120,19 +5120,6 @@ function drupal_add_tabledrag($table_id,
   drupal_add_js($settings, 'setting');
 }
 
-function drupal_aggregated_file_exists($uri) {
-  if (function_exists('apc_exists')) {
-    $exists = apc_exists('file_exists_' . $uri);
-    if (!$exists && file_exists($uri)) {
-      $exists = TRUE;
-      apc_store('file_exists_' . $uri, TRUE, 86400);
-    }
-    return $exists;
-  }
-  // If no APC available, fall back to default.
-  return file_exists($uri);
-}
-
 /**
  * Aggregates JavaScript files into a cache file in the files directory.
  *
@@ -5172,7 +5159,7 @@ function drupal_build_js_cache($files) {
     $uri = $map[$key];
   }
 
-  if (empty($uri) || !drupal_aggregated_file_exists($uri)) {
+  if (empty($uri) || !file_exists($uri)) {
     // Build aggregate JS file.
     foreach ($files as $path => $info) {
       if ($info['preprocess']) {
@@ -5180,10 +5167,8 @@ function drupal_build_js_cache($files) {
         $contents .= file_get_contents($path) . ";\n";
       }
     }
-
-    // Allow modules to act on the js_cache before writing to disk.
-    drupal_alter('js_cache', $contents);
-
+    // Remove JS source and source mapping urls or these may cause 404 errors.
+    $contents = preg_replace('/\/\/(#|@)\s(sourceURL|sourceMappingURL)=\s*(\S*?)\s*$/m', '', $contents);
     // Prefix filename to prevent blocking by firewalls which reject files
     // starting with "ad*".
     $filename = 'js_' . drupal_hash_base64($contents) . '.js';

The first few differences related to drupal_aggregated_file_exists are Pantheon additions. The drupal_alter is from Pressflow. The last difference to fix 404 errors related to JS source and source mapping is a fix in Drupal 7.79 that did not apply cleanly since it was made next to the Pressflow addition.