drupal_install_schema not used correctly
firfin - August 28, 2009 - 13:39
| Project: | IDEAL Easy | Ubercart Payment |
| Version: | 6.x-1.4 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | kees@qrios |
| Status: | needs review |
Description
When activating the modules the following errors appear and no table is created in MySQL.
* warning: Invalid argument supplied for foreach() in /sitedir/includes/common.inc on line 3283.
* warning: Invalid argument supplied for foreach() in /sitedir/includes/common.inc on line 3204. on cart/checkout the following appears:
user warning: Table 'db.uc_payment_ideal_easy' doesn't exist query: SELECT description FROM uc_payment_ideal_easy WHERE order_id = 140 in /.../sites/all/modules/uc_ideal_easy/uc_ideal_easy_payment.module on line 170.
and on /cart/checkout/review
* user warning: Table 'db.uc_payment_ideal_easy' doesn't exist query: DELETE FROM uc_payment_ideal_easy WHERE order_id = 141 in /.../sites/all/modules/uc_ideal_easy/uc_ideal_easy_payment.module on line 177.
* user warning: Table 'db.uc_payment_ideal_easy' doesn't exist query: SELECT description FROM uc_payment_ideal_easy WHERE order_id = 141 in /.../sites/all/modules/uc_ideal_easy/uc_ideal_easy_payment.module on line 170.Using Drupal 6.12 and Ubercart 6.x-2.0-rc6. So all prerequirements are met, right?
Marked as critical as this stands in the way of using the module, please change if this is incorrect.

#1
The problem doesn't seem to be specific to the Ideal Easy payment module. My own checkout pane module ( http://www.ubercart.org/contrib/11753 ) was experiencing the same symptoms.
The problems went away when I renamed the table created by the module to be exactly the same as the module name. Apparantly something in my install is bugged.
I 'fixed' this specific problem by doing the same to the ideal easy module on my setup (renaming table to uc_ideal_easy_payment instead of uc_payment_ideal_easy ). I could sent you the fix (a patch would unwieldy I think.)
#2
Thanks for posting.
Please be more specific, is the install hook broken? Did you have old D5 tables converted, having another name perhaps? Is your own module assuming table names have to be the same as module names?
I do not have a D6 project using this module at hand to test this.
#3
It is a fresh D6 / UC2 install. Not upgraded from D5. The problem with installing modules seems to be specific to my site and not related to the Ideal Easy payment module. One of my own modules had similar problems.
I have no idea what is broken (install hook or otherwise), but my workaround (making sure the db table has the same name as the module I'm trying to install) is good enough for now.
I believe the problem lies with my install and not the module, so maybe it is best to close this issue.
I do have some others issues with the module, but I will open another issue for that as it is not directly related to this one.
#4
I have found the problem (and solution.) Both our modules were not supplying drupal_install_schema() with the module name but with the schema name. Same goes for drupal_uninstall_schema().
See http://api.drupal.org/api/function/drupal_install_schema/6 for correct usage.
I have included a patch. It only changes uc_payment_ideal_easy to uc_ideal_easy_payment in forementioned functions. Solves the issue on my installs (tested on 3 servers / drupal+uc setups).
This blocks a succesful install in a fresh D6 install, so I marked it as critical. Attached a patch , so changed status to needs review. Please correct if I'm in error here.
#5
Waiting for community review