Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Strongarm currently cannot affect variables that are used very early in the Drupal bootstrap process. We should make a list of all of them and where possible / appropriate, find ways to allow Strongarm to affect them.
Comment | File | Size | Author |
---|---|---|---|
#8 | 661442_language_negotiation.patch | 641 bytes | hefox |
Comments
Comment #1
christianchristensen CreditAttribution: christianchristensen commentedI am sure I will find more, but at a quick glance I could not seem to proceed without errors in common.inc with "theme_default" variable in the strongarm group.
Comment #2
ktha CreditAttribution: ktha commentedI would also like to point out that many modules are defining constants that receive variable_get() values within the vody of the main module file. (eg: define('LDAPAUTH_LOGIN_CONFLICT', variable_get('ldapauth_login_conflict', LDAPAUTH_CONFLICT_LOG)); within ldapauth.module)
The module files are included before calling the init() hook thus the module defined constants end up with some default values instead of the strongarm'ed version of the variable.
Comment #3
dmitrig01 CreditAttribution: dmitrig01 commentedFor modules that do that, just file a bug against it. Constant is something that's unchanging, but variables can change.
Comment #4
dmitrig01 CreditAttribution: dmitrig01 commentedHere are the variables: cache_inc, page_cache_fastpath, lock_inc, reverse_proxy, dev_query, session_inc, cache_flush_cache, cache, language_count, language_default, and site_frontpage
Comment #5
dmitrig01 CreditAttribution: dmitrig01 commentedthough, site_frontpage has a little hack.
Comment #6
kentstanton CreditAttribution: kentstanton commentedIs the site_frontpage hack a good way to workaround this issue? It forces the re-execution of custom_url_rewrite_inbound which I'm not willing to do (too expensive). In our case Drupal is integrated into a larger site that includes other tools (moodle for one) and I use custom_url_rewrite_inbound to tie the systems together. There are easy ways to prevent going back through the path init process, but this seems like a larger question to be considered in any work to address the early variables issue.
Comment #7
hefox CreditAttribution: hefox commentedlanguage_negotiation is one too, but calling drupal_init_language should reset the language variable. Testing it out to see if has any side effects, I suspect it may be too late for some things though.
Comment #8
hefox CreditAttribution: hefox commentedQuickie not much tested patch, I still suspect it's too late to effect some things.
the variable is the one that determines how language is determined (based on path, domain, etc).
Comment #9
jrockowitz CreditAttribution: jrockowitz commentedMy 'hack' solution was in hook_strongarm() to variable_set() all 'boot' variables that are undefined since I wanted to 'strongarm' them and more importantly have them stored in code. I am going under the assumption that all my 'boot' modules followed the recommended practice and prefixed their variables with the name of the module.
I am not sure this 'hack' would be applicable for everyone. The below code is just some of my solution, which also includes caching the $strongarm data so that it is not rebuilt on every page request.
One catch to my solution is once a 'boot' variable is set and any changes to the 'boot' variable in-code won't automatically be applied. The Strongarm admin page (admin/settings/strongarm) still gives the user the option to apply any changes to a 'boot' variable.
I hope this helps.
~jake
Comment #10
joelstein CreditAttribution: joelstein commentedStrongarm integration with Boost suffers from this. An issue has been created: #933662: Strongarm Support.
Comment #11
timwoodsub
Comment #12
alberto56 CreditAttribution: alberto56 commentedsubscribing
Comment #13
theRuslanComment #14
floretan CreditAttribution: floretan commentedlanguage_content_type_[node-type] can be added to the list for the case where it is used to determine the accessibility of the "Translate" tab on nodes.
Comment #15
pearcec CreditAttribution: pearcec commentedsub
Comment #16
wanjee CreditAttribution: wanjee commentedsubscribing
Comment #17
pearcec CreditAttribution: pearcec commentedAdd glossary module to the list.
Comment #18
techninja CreditAttribution: techninja commentedIf you thought for a moment that using strongarm on locale_custom_strings_en for string replacements in t() was a good idea (looks at hefox)... You'd be wrongo!
hefox and I dug through after assuming it would work, and found the opposite to be true. No good workaround as of yet, other than ditching strongarm in favor of a same language .po file translation.
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedIf you have variables that need loaded at boot time move their initialization to hook_boot instead of hook_init, would this work?
Note, I don't use strongarm (yet) but I am here because of #1132958-1: Access denied on xmlsitemap/rebuild.
Comment #20
JeremyFrench CreditAttribution: JeremyFrench commentedI got hit with this and page caching.
My personal take on a solution is to have a blacklist of variables which strongarm will not set. Explain why if people try. I expect a solution for people wanting to have non db variables that can be used earlier in the bootstrap is to define them in settings.php
Comment #21
hefox CreditAttribution: hefox commentedThis will be deprecated with #1094598: Performance issues from strongarm_init() tmk
Comment #22
hefox CreditAttribution: hefox commentedNo longer relavent as variables are back in the database always