0

Recent updates to Drupal 7 have included changes in default.settings.php.

Do they need to be incorporated into settings.php manually, or does the code automatically look up in default.settings.php when it can't find something in settings.php? Apologies if this is in the documentation, I couldn't find it.

5
  • I am just going to say no ( I have not for over 10 years) and manny manny manny sites are just fine lol
    – taggartJ
    Commented Mar 17, 2023 at 5:55
  • Have your site in an isolated env and try it out yourself.
    – leymannx
    Commented Mar 17, 2023 at 7:16
  • Well, it's good to know I'm not alone! Still. would be good to know what the code's expectations are.
    – wil_SRQ
    Commented Mar 17, 2023 at 8:18
  • 1
    I guess it depends on what the changes are. Code comment updates, or security changes.. you'd want to incorporate the latter for sure.
    – Kevin
    Commented Mar 17, 2023 at 14:04
  • Yes that's what I mean, but you could have setups too that generate new sites from a default settings file through a UI. Then the new site has the updates in its new settings.php file.
    – Kevin
    Commented Mar 18, 2023 at 11:54

1 Answer 1

1

Speaking specifically about the last change done for the default.settings.php file: No, you do not need to apply that change to the setting.php file, except in the case you need to change the default value used for the lock expiration timeout, which is 900 and which usually sufficient for any site.

The following is the patch for the change described in [D7] Cron lock time limit is too short and does not prevent multiple, concurrent cron runs.

diff --git a/includes/common.inc b/includes/common.inc
index 0f6ced800d..094db87f54 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5532,7 +5532,8 @@ function drupal_cron_run() {
   drupal_alter('cron_queue_info', $queues);
 
   // Try to acquire cron lock.
-  if (!lock_acquire('cron', 240.0)) {
+  $cron_lock_expiration_timeout = variable_get('cron_lock_expiration_timeout', 900.0);
+  if (!lock_acquire('cron', $cron_lock_expiration_timeout)) {
     // Cron is still running normally.
     watchdog('cron', 'Attempting to re-run cron while it is already running.', array(), WATCHDOG_WARNING);
   }
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index c521bc3b3a..4458ee47d0 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -821,3 +821,15 @@
  */
 # $conf['drupal_http_request_strip_sensitive_headers_on_host_change'] = TRUE;
 # $conf['drupal_http_request_strip_sensitive_headers_on_https_downgrade'] = TRUE;
+
+/**
+ * Cron lock expiration timeout:
+ *
+ * Each time Drupal's cron is executed, it acquires a cron lock. Older releases
+ * of Drupal set the default cron lock expiration timeout to 240 seconds. This
+ * duration was considered short, because it often caused concurrent cron runs
+ * especially on busy sites heavily utilizing cron.
+ *
+ * Use this variable to set a custom cron lock expiration timeout (float).
+ */
+# $conf['cron_lock_expiration_timeout'] = 900.0;

The last comment explains exactly what the purpose of that value is and why it was introduced.

Each time Drupal's cron is executed, it acquires a cron lock. Older releases of Drupal set the default cron lock expiration timeout to 240 seconds. This duration was considered short, because it often caused concurrent cron runs especially on busy sites heavily utilizing cron.

If you do not notice any Attempting to re-run cron while it is already running. error in the Drupal log, then you do not need to add that line ($conf['cron_lock_expiration_timeout'] = 900.0;) to the settings.php file used for the site. Otherwise, you need to add it.

does the code automatically look up in default.settings.php when it can't find something in settings.php?

No, it does not. Drupal only load the settings.php file, when running. Any change done to the default.settings.php file that is relevant for you need to be copied into the settings.php file used for the site. Keep in mind that, in some cases, the copied lines could need to be adapted for your use case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.