backdrop-contrib / domain

A domain-based access control system for Backdrop CMS
https://backdropcms.org/project/domain
3 stars 5 forks source link

Domain access failed to load during phase: bootstrap include. Please check your settings.php file and site configuration. #4

Closed bdalomgir closed 9 months ago

bdalomgir commented 9 months ago

We are trying to help with the port of this module and are looking for help solving this problem.

I tried to install the domain module multiple times and each time I found the following error, seems we are stuck over here.

Domain access failed to load during phase: bootstrap include. Please check your settings.php file and site configuration.

Steps to reproduce:

  1. Install a fresh Backdrop.
  2. Download domain module from - https://github.com/backdrop-contrib/domain
  3. added the below line to the settings file include BACKDROP_ROOT . '/modules/domain/settings.inc';
  4. Install only the "Domain Access" module through UI.
  5. Got error "Domain access failed to load during phase: bootstrap include. Please check your settings.php file and site configuration."
  6. Rebuild permission
  7. Added the following line to the settings file $conf['domain_hide_errors'] = TRUE;

Still, the error persists mentioned in step 5.

Any thoughts or suggestions for how we resolve (debug) this issue and move on to the next?

stpaultim commented 9 months ago

@bdalomgir Are there any other issues showing up in the Backdrop error log or is this the error that is blocking any progress?

Maybe if there are other errors showing up and we fix them, it will help with the bootstrapping process?

bdalomgir commented 9 months ago

@stpaultim I did not find any other errors in the Backdrop error logs, it shows only one error I mentioned above without mentioning the file name or line numbers. Please check the screenshot.

Log-message-Backdrop-Domain

herbdool commented 9 months ago

I don't think $conf is a global variable anymore.

stpaultim commented 9 months ago

@jenlampton Shared this feedback in Zulip.

I'd remove the line from your settings file (step 3) and try again.

That's not a safe way to include files anyway, and there may be something in that file that's causing issues.

See if the module will install without whatever's in that file.

yorkshire-pudding commented 9 months ago

@bdalomgir - I don't have an answer, but a possible clue. I installed the Object Log module and in file domain.module on line 97, which is just before that error is generated, I added the following line.:

  object_log('domain_init:$_domain', $_domain);

Looking in Object Log (admin/reports/object_log) I see that this is an empty array so somewhere the list of domains is not being loaded, which is triggering that error.

This module could be helpful, but it will only help once backdrop is bootstrapped; no good in the initialization phases.

I've also spotted some Coder Upgrade relics - search for "dynamic variable" . I don't think any of these are the cause though.

stpaultim commented 9 months ago

@yorkshire-pudding or @bdalomgir

How could it have a list of domains before it's been bootstrapped. This needs to be configured later.

yorkshire-pudding commented 9 months ago

@stpaultim - I'm probably not understanding this but it didn't look like hook_init() is called before bootstrap

stpaultim commented 9 months ago

@jenlampton

I'd remove the line from your settings file (step 3) and try again.

That line was not there. The Drupal readme suggests adding that line. We've tried it with and without that line and the results are the same.

stpaultim commented 9 months ago

@bdalomgir or @sudipto68 I just noticed that despite getting that error, the module is installed and has a menu item for configuration (/admin/structure/domain). When I try to go to that page, I get this error.

Fatal error: require_once(): Failed opening required '/app/modules/domain-1.x-3.x/domain.admin.inc' (include_path='.:/usr/local/lib/php') in /app/core/modules/system/system.module on line 2619

Why don't we move on and work on this error and see where it takes us.

image

yorkshire-pudding commented 9 months ago

@stpaultim - just noticed that your module folder does not match the module machine name. I.e. domain-1.x-3.x rather than domain. That may be the problem here as I think I was able to open the admin page and do some stuff there, albeit with errors.

Fatal error: require_once(): Failed opening required '/app/modules/domain-1.x-3.x/domain.admin.inc' (include_path='.:/usr/local/lib/php') in /app/core/modules/system/system.module on line 2619

stpaultim commented 9 months ago

@yorkshire-pudding I figured that one out myself and was able to resolve the above error.

image (10)

I'm now this far, but everything I do generates the original error message.

yorkshire-pudding commented 9 months ago

Yes, same one I'm stuck with.

EDIT: Oops, pressed wrong button, subconscious wishful thinking maybe

sudipto68 commented 9 months ago

@stpaultim @bdalomgir I could solve this Domain access failed to load during phase: bootstrap include error by changing this following code in the domain.module file on line no #99.

  $_domain = domain_default(TRUE);

  // Error handling in case the module is not installed correctly.
  if (!isset($_domain['domain_id'])) {
    $_domain['error'] = 'bootstrap include';
  }

I have just placed the $_domain = domain_default(TRUE); line before the if condition. Because I think, on the first time we have a default domain, so we can set $_domain = domain_default(TRUE). If anything goes wrong and it could not find default domain_id then, it can go to the if block.

I have found another issue, this domain access options form was not showing on the node add/edit form. code2

I saw that they were checking, if this is node form then show the domain access options form, on all other form it will return nothing, the code was previously like this(on line number #2946 in domain.module file).

// Apply to all node editing forms only.
  if (empty($form['#node_edit_form'])) {
    return;
  }

I have changed the above code to this (But I think only this #node checking is not proper way).

 if (empty($form['#node'])) {
    return;
  }

Because I think in backdrop cms there is no #node_edit_form in node add/edit form. After this change the domain access options is showing on node add/edit forms.

I have found another issue after installing this module, if we don't save this configuration then the default domain won't get saved and so that default domain was not showing on the domain list page. A default domain creates but just not show on the domain list page if we don't save this configuration after installing the module.

code5

stpaultim commented 9 months ago

@sudipto68 - It was my experience last week, that the new domain does not show up on list immediately. But, eventually it did show up.

stpaultim commented 9 months ago

@sudipto68 - Can you create a Pull Request with the changes you made here?

yorkshire-pudding commented 9 months ago

@sudipto68 - Thanks for your work on this; I look forward to testing your PR. Minor point, please can you put code snippets in rather than screenshots of code snippets.

Open with ```php

and close with

``` and GitHub does syntax formatting

stpaultim commented 9 months ago

@sudipto68 and @bdalomgir - I'm going to close this issue for now, because I think the PR we just merged is at least a temporary fix. Let's move on to other issues.