Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I'm pretty sure @dawehner is correct in #6 that these scripts are not to be run from a D8 install.
That is verified by the D6 one containing db_fetch_array() which doesn't exist in D8. Sadly, both scripts already contain \Drupal::moduleHandler()->getModuleList().
index ace93d9..048ed24 100644
--- a/core/scripts/dump-database-d6.sh
--- a/core/scripts/dump-database-d6.sh
+++ b/core/scripts/dump-database-d6.sh
index 4689672..b722fe4 100644
--- a/core/scripts/dump-database-d7.sh
--- a/core/scripts/dump-database-d7.sh
+++ b/core/scripts/dump-database-d7.sh
Yep do not change these files - these are d6 and d7 code. So could be "closed won't fixed". But now we can get on with the removal of the drupal_var_export function. So let's repurpose this issue. Since @Palashvijay4O already made the nice CR and attached it to this issue.
This issue is a prioritized change (deprecated function removal) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. Committed 40b2f16 and pushed to 8.0.x. Thanks!
Comments
Comment #1
gumanist commented$ git grep drupal_var_export
core/includes/utility.inc:function drupal_var_export($var, $prefix = '') {
core/scripts/dump-database-d6.sh:// Include the utility drupal_var_export() function.
core/scripts/dump-database-d6.sh: $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";
core/scripts/dump-database-d6.sh: $insert .= '->values('. drupal_var_export($record) .")\n";
core/scripts/dump-database-d6.sh: $output .= "db_insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
core/scripts/dump-database-d7.sh:// Include the utility drupal_var_export() function.
core/scripts/dump-database-d7.sh: $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";
core/scripts/dump-database-d7.sh: $insert .= '->values('. drupal_var_export($record) .")\n";
core/scripts/dump-database-d7.sh: $output .= "db_insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
Comment #2
gumanist commented$ git grep drupal_var_export
core/includes/utility.inc:function drupal_var_export($var, $prefix = '') {
core/scripts/dump-database-d6.sh:// Include the utility drupal_var_export() function.
core/scripts/dump-database-d6.sh: $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";
core/scripts/dump-database-d6.sh: $insert .= '->values('. drupal_var_export($record) .")\n";
core/scripts/dump-database-d6.sh: $output .= "db_insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
core/scripts/dump-database-d7.sh:// Include the utility drupal_var_export() function.
core/scripts/dump-database-d7.sh: $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";
core/scripts/dump-database-d7.sh: $insert .= '->values('. drupal_var_export($record) .")\n";
core/scripts/dump-database-d7.sh: $output .= "db_insert('". $table . "')->fields(". drupal_var_export(array_keys($data['fields'])) .")\n";
Comment #3
Palashvijay4O commentedComment #4
Palashvijay4O commentedTest patch .
Comment #5
dawehnerI always thought that these scripts run under d6/d7 itself, can you clarify whether they still work?
Comment #6
dawehnerThese usages are actually valid as they are executed in the context of Drupal 6 / 7 if I understand it correctly.
Comment #7
chx commentedThose scripts might be needed to create tests for D8 -> D8 migrations when we get there.
Comment #8
chx commentedAnd this looks great, thanks for the patch.
Comment #9
alexpottI can't find a change record for the creation of the
Variableclass and the deprecation ofdrupal_var_export(). #2022931: Move drupal_var_export() to \Drupal\Component\Utility does not reference one and searches reveal nothing. Can some on add one (https://www.drupal.org/node/add/changenotice) and link to this issue and that one.Comment #10
chx commentedChange notice has been written, thanks Palashvijay4O
Comment #11
tstoecklerHehe, these scripts are always fun. :-)
I'm pretty sure @dawehner is correct in #6 that these scripts are not to be run from a D8 install.
That is verified by the D6 one containing
db_fetch_array()which doesn't exist in D8. Sadly, both scripts already contain\Drupal::moduleHandler()->getModuleList().So, not really sure what to do here.
Comment #12
alexpottYep do not change these files - these are d6 and d7 code. So could be "closed won't fixed". But now we can get on with the removal of the
drupal_var_exportfunction. So let's repurpose this issue. Since @Palashvijay4O already made the nice CR and attached it to this issue.Comment #13
chx commented> Yep do not change these files - these are d6 and d7 code.
D7. D6 didnt have drupal_var_export AFAIK.
Comment #14
jamesdixon commentedIn that case the only file left we may need to change is:
Should we remove the function from utility.inc?
Comment #15
alexpottYes
Comment #16
Palashvijay4O commentedOk . Removed the function.
Comment #17
tstoecklerYup, awesome.
Comment #18
alexpottThis issue is a prioritized change (deprecated function removal) as per https://www.drupal.org/core/beta-changes and it's benefits outweigh any disruption. Committed 40b2f16 and pushed to 8.0.x. Thanks!