I am working on improving Google Page Speed on a site. As part of this, I made a couple of changes to the js and css loading code in my template.php, installed (and uninstalled) the async_js module, and installed the AdvAgg modules.

Everything works as expected in my local environment. When I checked in and pushed to Pantheon, I noticed that any changes to the performance settings don't get persisted. When I make a change and click "save Configuration", the page displays The configuration options have been saved and reverts back to the original:

enter image description here

Then, before deploying anything to Test, I tried this in the Pantheon Test environment, and the page did persist changes. So I deployed my changes (about 5 or 6 commits). Now it no longer worked in Test, either. I made no other changes, just deployed my commits.

Then I reverted all my commits and pushed to Dev. The page still does not save in Dev, even though, at least in theory, the environment should now be the same as when I started. This always worked locally, and no, there is no reason to believe that caching is causing this. I tried different user accounts in Dev and they all behave the same. There is nothing in the log. I have been pulling my hair out over this for hours and would appreciate any pointers.

Thanks to Clive's suggestion I checked the code in settings.php directly in the Pantheon environment and found this code, and it explains everything .... and yes, the live environment did show the same behavior. Why I thought that the test environment did not, prior to my deployment, I really cannot say.

if (defined('PANTHEON_ENVIRONMENT')) {
  // Drupal caching in development environments.
  if (!in_array(PANTHEON_ENVIRONMENT, array('test', 'live'))) {
    // Anonymous caching.
    $conf['cache'] = 0;
    // Block caching - disabled.
    $conf['block_cache'] = 0;
    // Expiration of cached pages - none.
    $conf['page_cache_maximum_age'] = 0;
    // Aggregate and compress CSS files in Drupal - off.
    $conf['preprocess_css'] = 0;
    // Aggregate JavaScript files in Drupal - off.
    $conf['preprocess_js'] = 0;
// Drupal caching in test and live environment
.... etc
  • 1
    Check settings.php in each environment, you're probably overriding vars in there and passing them to each instance without realising it. settings.php shouldn't be in version control IMO, if it's in there take it out – Clive Nov 13 '16 at 14:03
  • Sorry, my bad. I meant to say "template.php". Will correct this in the post. – cdonner Nov 13 '16 at 14:20
  • 1
    I did mean settings.php though - what you're describing is exactly what happens when you override vars in settings.php. Its a lot less likely you'd have managed to get the same effect in template.php – Clive Nov 13 '16 at 14:22
  • Yes, I appreciate this, but my settings.php is not in source control and did not change. – cdonner Nov 13 '16 at 15:14
  • And yes, you are right, it does override the settings on this page! I forgot about this. We hard-coded the cache settings for the various environments when the site was built years ago. If you want to put this into an answer, I will happily accept it. – cdonner Nov 13 '16 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.