Closed (fixed)
Project:
Migrate
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2010 at 19:45 UTC
Updated:
20 Feb 2011 at 22:20 UTC
Not sure if it's because of something I'm doing wrong, but I just installed the latest version of the 2.x dev migrate module and am getting the error:
Fatal error: Uncaught exception 'DatabaseConnectionNotDefinedException' with message 'The specified database connection is not defined: default' in ...
default /is/ defined in settings.php and the site works normally.
I get the exception on admin/migrate/BeerTerm (and every other link on the admin/migrate page).
Comments
Comment #1
hadsie commentedTracking down this one, it appears that in the UI for whatever reason dbtng_init() is not getting executed early enough. Setting the weight of the dbtng module to -1 fixes it.
In my setup I have og enabled, and as long as dbtng's weight is less than og then everything works fine. It appears that within og_init() there's a (indirect) call to menu_get_item() and triggers migration_load() in migrate_ui.module prematurely (this is due to the menu item: admin/migrate/%migration).
I'm not sure of a way to fix this or any better workaround than setting dbtng's weight to -1 at this point. But it seems like migration_load and migration_title shouldn't be called if dbtng hasn't been loaded yet.
Comment #2
moshe weitzman commentedI have og as well and am not seeing an error. might be fixed in latest autoload+dbtng+migrate
Comment #3
hadsie commentedI have a feeling that this client may have hacked the OG module to do some funky path stuff, which would explain this. I haven't compared against a stock copy of OG yet but I'm quite certain this is what's happened now.
Comment #5
Ivo.Radulovski commentedany solution here? had the same error....
Comment #6
sadist commentedI am still getting this error regardless of which version or migrate or dbtng modules I installed. I'm able to produce this error by just running cron, right after migrate.module is enabled.
PS: this is with fresh Drupal installation
Comment #7
mikeryanHow are you running cron? Where precisely do you see the message? I cannot reproduce this with either drush cron or invoking cron from the status report page.
Comment #8
sadist commentedDrupal Cron, from the status page. My web server is running Php by CGi. Not sure if that matter.
Comment #9
mikeryanUgh. I don't know of a specific reason it would matter (does CGI affect the PHP autoload behavior?), but CGI in 2011? Your webhost needs to join the 21st century... Has anyone seen this issue in a non-CGI environment?
Comment #10
catapultparlor commentedi'm getting this error.
Steps:
Installed and enabled autoload & dbtng.
Installed and enabled migrate.
Realized that I had installed wrong version of autoload.
Had some errors trying to disable Migrate.
Uninstalled autoload, dbtng and migrate and deleted from server.
update.php, cron, etc, no errors.
Installed and enabled each, one at a time, and ran update.php each time just in case.
When I ran update.php after seemingly successfully installing Migrate, i received the above error while trying to run the update script.
After the "0 of 0" thinking happened.
This is on a Dreamhost server that should be up-to-date.
Comment #11
sadist commentedsorry, I posted that using mobile and didn't get the message across. What I meant was PHP is installed as CGI/SuExec, not inside 'cgi-bin' folder for CGI/Perl scripts. I believe it offers better server security.
Comment #12
jcfiala commentedI'm getting this error when I'm running update.php (via the web browser) and it's a real pain. The error I"m getting is this:
Uncaught exception 'DatabaseConnectionNotDefinedException'
with message 'The specified database connection is not defined: default'
in /var/aegir/hpdb/sites/all/modules/contrib/dbtng/database/database.inc:1516
Stack trace:
#0 /var/aegir/hpdb/sites/all/modules/contrib/dbtng/database/database.inc(1317): Database::openConnection('default', 'default')
#1 /var/aegir/hpdb/sites/all/modules/contrib/dbtng/dbtng.module(179): Database::getConnection('default')
#2 /var/aegir/hpdb/sites/all/modules/contrib/migrate/migrate.module(102): db_select('migrate_status', 'ms')
#3 [internal function]: migrate_flush_caches()
#4 /var/aegir/hpdb/includes/module.inc(483): call_user_func_array('migrate_flush_c...', Array)
#5 /var/aegir/hpdb/includes/common.inc(3775): module_invoke_all('flush_caches')
#6 /var/aegir/hpdb/update.php(288): drupal_flush_all_caches()
#7 /var/aegir/hpdb/includes/batch.inc(302): update_finished(true, Array, Array)
#8 /var/aegir/hpdb/includes/batch.inc(43): _batch_finished()
#9 /var/aegir/hpdb/update.php(679): in /var/aegir/hpdb/sites/all/modules/contrib/dbtng/database/database.inc on line 1516
I'm guessing that migrate_flush_caches() is trying to use dbtng, but since we've come in from update.php, dbtng doesn't know about the database. I tried setting the dbtng module to have weight -1, but that doesn't seem to have helped.
Yeah... I just put 'dbtng_init()' in at line 96, at the start of migrate_flush_caches(), and the problem went away when I did an update.php again. So it really does seem to be that during an update.php, the hook_init isn't being called... but whether that's a problem with migrate, dbtng, or core, I'm not sure.
Comment #13
moshe weitzman commentedFor some obscure reason we don't fire init and friends on update.php so the proposed fix sounds right to me.
Comment #14
jcfiala commentedAh, yes, well, there you go. _drupal_boostrap_full(), in common.inc:
So... Hm. Maybe this is a dbtng problem.
Comment #15
jcfiala commentedAnd I posted my response around the same time as moshe, without doing a refresh. Never mind!
Comment #16
mikeryanWell, I was going to go ahead and insert the dbtng_init(), but... no such function. It's been removed from the dbtng module since the alpha7 release. Can anyone who is seeing this problem update to the latest dbtng dev release and see if you still have trouble?
Thanks.
Comment #17
mikeryanNo further reports, I'm assuming for now this is an artifact of older versions of dbtng.