uuid.drush.inc 907 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @file
  4. * Drush implementation for the uuid module.
  5. */
  6. /**
  7. * Implements hook_drush_command().
  8. */
  9. function uuid_drush_command() {
  10. $items = array();
  11. $items['uuid-create-missing'] = array(
  12. 'description' => 'Create missing UUIDs for enabled entities.',
  13. 'aliases' => array('uuid-create'),
  14. );
  15. return $items;
  16. }
  17. /**
  18. * Implements hook_drush_help().
  19. */
  20. function uuid_drush_help($section) {
  21. switch ($section) {
  22. case 'drush:uuid-create-missing':
  23. return dt("This command will create missing UUIDs for those content types specified in the module settings for automatic generation.");
  24. }
  25. }
  26. /**
  27. * Drush command callback.
  28. */
  29. function drush_uuid_create_missing() {
  30. if (!drush_confirm(dt('Are you sure?'))) {
  31. return drush_user_abort();
  32. }
  33. module_load_include('inc', 'uuid', 'uuid');
  34. drush_log(dt('Beginning bulk creation of UUIDs.'), 'ok');
  35. uuid_sync_all();
  36. }