backdrop-contrib / backdrop_upgrade_status

Checks to see if the installed modules on a Drupal 7 site are ready for upgrade to Backdrop CMS.
1 stars 5 forks source link

prefix tables #29

Closed catorghans closed 1 year ago

catorghans commented 2 years ago

admin/reports/backdrop-upgrade gives an error:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '.field_data_comment_body' doesn't exist:: SELECT count(entity_id) FROM field_data_comment_body; Array ( ) in field_backdrop_upgrade_status_report() (line 66 van /sites/all/modules/backdrop_upgrade_status/includes/backdrop_upgrade_status.field.inc).

Which makes sense, because that table contains a prefix in the database. I looked a the code, it contains "FROM {$table}" I guess that should work, but it doesn't.

admin/reports/updates/backdrop-upgrade also does not work, it can not fetch the update-data. Could be the same issue, but I could not find more details about why it could not fetch them

catorghans commented 2 years ago

This makes it work:

$count = db_query("SELECT count(entity_id) FROM {".$table."}")->fetchField();

oadaeh commented 2 years ago

Ah, PHP is probably treating it as a variable variable, which is why it isn't working: https://www.php.net/manual/en/language.variables.variable.php

jenlampton commented 1 year ago

Thanks for the report, and the resolution!