backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 39 forks source link

state_get triggers an error during profile install #4518

Open robertgarrigos opened 4 years ago

robertgarrigos commented 4 years ago

Description of the bug

Working on a new profile, I wanted to implement the hook_install_tasks() function as it's shown in the api docs (https://api.backdropcms.org/api/backdrop/core%21modules%21system%21system.api.php/function/hook_install_tasks/1) which includes the function state_get() to set a batch_processing variable. Unfortunately, this triggers this error:

Error: Call to undefined function lock_acquire() in state_initialize() (line 1278 of /app/www/core/includes/bootstrap.inc).

The problem is that lock.inc file is not included during install, because lock_acquire function uses the semaphore table, which is not yet installed.

Has this ever been tested? What's the way to use a batch state variable during a profile install??

docwilmot commented 4 years ago

Interesting. Could you add require_once BACKDROP_ROOT . '/' . settings_get('lock_inc', 'core/includes/lock.inc'); to install_begin_request() (somewhere after the line backdrop_bootstrap(BACKDROP_BOOTSTRAP_CONFIGURATION);) and recheck?

robertgarrigos commented 4 years ago
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'backdrop.semaphore' doesn't exist
robertgarrigos commented 4 years ago

I can add that, by not using the state_get function within the hook_install_tasks, I get it working (of course, without trying the batch processing)

robertgarrigos commented 4 years ago

sorry for the typo ;-)

klonos commented 1 year ago

Interesting. Could you add require_once BACKDROP_ROOT . '/' . settings_get('lock_inc', 'core/includes/lock.inc'); to install_begin_request() (somewhere after the line backdrop_bootstrap(BACKDROP_BOOTSTRAP_CONFIGURATION);) and recheck?

@robertgarrigos it's been a while now, did you manage to test this?

@docwilmot not sure about here, but your suggestion fixes the errors in (the otherwise unrelated) #5943.

robertgarrigos commented 1 year ago

I did try that, @klonos . This was the result:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'backdrop.semaphore' doesn't exist
klonos commented 1 year ago

Thanks for taking the time to report back @robertgarrigos 🙏🏼 ...that's similar to the error thrown in #5943, so if not the same cause, then definitely related.