It only holds one function that is used nowhere in core, but the database import scripts, where the native var_export function should be used.

Comments

ParisLiakos’s picture

Status: Active » Needs review
StatusFileSize
new4.95 KB

It can live in devel module, if somewhere

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

drupal_var_export() was more useful when we exported config in php files, but ctools had it's own version anyway.

catch’s picture

Status: Reviewed & tested by the community » Needs review

Hold on, iirc this was added explicitly for the db upgrade test scripts. Those need to be human readable for debugging/alterations directly. Needs more review.

ParisLiakos’s picture

hmm...those scripts are not even working

PHP Warning:  include_once(./includes/bootstrap.inc): failed to open stream: No such file or directory in /var/www/d8/core/scripts/dump-database-d7.sh on line 28
PHP Stack trace:
PHP   1. {main}() /var/www/d8/core/scripts/dump-database-d7.sh:0
PHP Warning:  include_once(): Failed opening './includes/bootstrap.inc' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/d8/core/scripts/dump-database-d7.sh on line 28
PHP Stack trace:
PHP   1. {main}() /var/www/d8/core/scripts/dump-database-d7.sh:0
PHP Fatal error:  Call to undefined function drupal_bootstrap() in /var/www/d8/core/scripts/dump-database-d7.sh on line 29
PHP Stack trace:
PHP   1. {main}() /var/www/d8/core/scripts/dump-database-d7.sh:0

if i run them from Drupal root as script docs say

PHP Notice:  Constant DRUPAL_ROOT already defined in /var/www/d8/core/includes/bootstrap.inc on line 245
PHP Stack trace:
PHP   1. {main}() /var/www/d8/core/scripts/dump-database-d7.sh:0
PHP   2. include_once() /var/www/d8/core/scripts/dump-database-d7.sh:28
PHP   3. define() /var/www/d8/core/includes/bootstrap.inc:245
PHP Warning:  require_once(/var/www/d8/core/core/lib/Drupal.php): failed to open stream: No such file or directory in /var/www/d8/core/includes/bootstrap.inc on line 521
PHP Stack trace:
PHP   1. {main}() /var/www/d8/core/scripts/dump-database-d7.sh:0
PHP   2. drupal_bootstrap() /var/www/d8/core/scripts/dump-database-d7.sh:29
PHP   3. _drupal_bootstrap_configuration() /var/www/d8/core/includes/bootstrap.inc:1823
PHP   4. drupal_environment_initialize() /var/www/d8/core/includes/bootstrap.inc:1990
PHP Fatal error:  require_once(): Failed opening required '/var/www/d8/core/core/lib/Drupal.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/d8/core/includes/bootstrap.inc on line 521
PHP Stack trace:
PHP   1. {main}() /var/www/d8/core/scripts/dump-database-d7.sh:0
PHP   2. drupal_bootstrap() /var/www/d8/core/scripts/dump-database-d7.sh:29
PHP   3. _drupal_bootstrap_configuration() /var/www/d8/core/includes/bootstrap.inc:1823
PHP   4. drupal_environment_initialize() /var/www/d8/core/includes/bootstrap.inc:1990

If i run them inside the core directory..am i missing something or we should open a critical?

dawehner’s picture

@ParisLiakos
You should run this script from drupal 7, not drupal 8.

ParisLiakos’s picture

Status: Needs review » Closed (won't fix)
// var_export
db_create_table('wysiwyg_user', array (
  'fields' => 
  array (
    'uid' => 
    array (
      'type' => 'int',
      'unsigned' => true,
      'not null' => true,
      'default' => 0,
    ),
    'format' => 
    array (
      'type' => 'varchar',
      'length' => 255,
      'not null' => false,
    ),
   //......
  'module' => 'wysiwyg',
  'name' => 'wysiwyg_user',
));

// drupal_var_export
db_create_table('wysiwyg_user', array(
  'fields' => array(
    'uid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
    ),
    'format' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => FALSE,
    ),
    //...
  'module' => 'wysiwyg',
  'name' => 'wysiwyg_user',
));

Both readable, just with drupal_var_export array( is not in new line..
i guess we can let this file be, if we want our dumps to obey our coding standards

tim.plunkett’s picture

Title: Remove utility.inc » Move drupal_var_export() to \Drupal\Component\Utility
Status: Closed (won't fix) » Active
Issue tags: +Kill includes

Agreed we don't need to delete it, but we should still move it.

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new4.5 KB
ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community

i was thinking that maybe Drupal\Core would be more suitable, but other projects could use the same coding standards as Drupal, so why dont make sharing easier?:)

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs work

I think drupal_var_export() should at least be marked @deprecated, though.

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new448 bytes
new4.59 KB

You could have just done that instead of marking NW

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary