user_import_delete.install 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * @file
  4. * Import and update users from a comma separated file (csv).
  5. */
  6. /**
  7. * Implementation of hook_schema().
  8. */
  9. function user_import_delete_schema() {
  10. $schema['user_import_delete'] = array(
  11. 'description' => t("Log of users that have been imported."),
  12. 'fields' => array(
  13. 'import_id' => array(
  14. 'description' => t("ID key of import."),
  15. 'type' => 'int',
  16. 'not null' => TRUE,
  17. 'default' => 0,
  18. 'disp-width' => '10'
  19. ),
  20. 'uid' => array(
  21. 'description' => t("ID key of user imported."),
  22. 'type' => 'int',
  23. 'not null' => TRUE,
  24. 'default' => 0,
  25. 'disp-width' => '10'
  26. ),
  27. 'cancellation_method' => array(
  28. 'description' => t("Account cancellation method."),
  29. 'type' => 'varchar',
  30. 'length' => '35',
  31. 'not null' => TRUE,
  32. 'default' => ''
  33. ),
  34. 'delete_ready' => array(
  35. 'description' => t("Flag user for deletion."),
  36. 'type' => 'int',
  37. 'not null' => TRUE,
  38. 'default' => 0,
  39. 'disp-width' => '10'
  40. ),
  41. ),
  42. );
  43. return $schema;
  44. }
  45. /**
  46. * Change the account_key field to a standard uid field.
  47. */
  48. function user_import_delete_update_7000() {
  49. db_change_field('user_import_delete', 'account_key', 'uid',
  50. array(
  51. 'type' => 'int',
  52. 'not null' => TRUE,
  53. 'default' => 0,
  54. 'description' => "ID key of user imported.",
  55. )
  56. );
  57. }
  58. /**
  59. * Add the delete ready flag field.
  60. */
  61. function user_import_delete_update_7001() {
  62. db_add_field('user_import_delete', 'delete_ready',
  63. array(
  64. 'description' => t("Flag user for deletion."),
  65. 'type' => 'int',
  66. 'not null' => TRUE,
  67. 'default' => 0,
  68. 'initial' => 0,
  69. 'disp-width' => '10'
  70. )
  71. );
  72. }
  73. /**
  74. * Add the cancellation method field.
  75. */
  76. function user_import_delete_update_7002() {
  77. db_add_field('user_import_delete', 'cancellation_method',
  78. array(
  79. 'description' => t("Account cancellation method."),
  80. 'type' => 'varchar',
  81. 'length' => '35',
  82. 'not null' => TRUE,
  83. 'default' => ''
  84. )
  85. );
  86. }
  87. /**
  88. * Clear all in progress deletes. IMPORTANT: Please redo the previous import if you want to delete unwanted accounts.
  89. */
  90. function user_import_delete_update_7003() {
  91. db_delete('user_import_delete')->execute();
  92. }