scratch.php

  1. 8.0.x commands/core/scratch.php
  2. 6.x commands/core/scratch.php
  3. 7.x commands/core/scratch.php
  4. 3.x commands/core/scratch.php
  5. 4.x commands/core/scratch.php
  6. 5.x commands/core/scratch.php

Use this file as a php scratchpad for your Drupal site. You might want to load a node, change it, and call node_save($node), for example. If you have used the Execute PHP feature of devel.module, this is the drush equivalent.

You may edit this file with whatever php you choose. Then execute the file using `drush script scratch.php`. That command will bootstrap your drupal site and then run the php below.

The script command enables you to store your script files wherever you wish and will help you list all of them should you collection grow. See its help.

File

commands/core/scratch.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Use this file as a php scratchpad for your Drupal site. You might want to
  5. * load a node, change it, and call node_save($node), for example. If you have
  6. * used the Execute PHP feature of devel.module, this is the drush equivalent.
  7. *
  8. * You may edit this file with whatever php you choose. Then execute the file
  9. * using `drush script scratch.php`. That command will bootstrap your drupal
  10. * site and then run the php below.
  11. *
  12. * The script command enables you to store your script files wherever you wish and
  13. * will help you list all of them should you collection grow. See its help.
  14. *
  15. */
  16. // Just some ideas to get the juices flowing.
  17. drush_print_r(user_roles());
  18. drush_print_r($GLOBALS['user']);