migration.custom.class.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * This file contains the MigrationCustom class, which defines methods to
  4. * alter the data from the original database when importing it to the Chamilo
  5. * database
  6. */
  7. /**
  8. * The custom migration class allows you to define rules to process data
  9. * during the migration
  10. */
  11. class MigrationCustom {
  12. /**
  13. * The only required method is the 'none' method, which will not trigger
  14. * any process at all
  15. * @param mixed Data
  16. * @param mixed Unaltered data
  17. */
  18. public function none($data) {
  19. return $data;
  20. }
  21. /**
  22. * Transform the uid identifiers from MSSQL to a string
  23. * @param string Field name
  24. * @return string SQL select string to include in the final select
  25. */
  26. public function sql_alter_unhash_50($field) {
  27. return 'cast(' . $field . ' as varchar(50))';
  28. }
  29. /**
  30. * Log data from the original users table
  31. */
  32. public function log_original_user_unique_id(&$omigrate, $data) {
  33. $omigrate['users'][$data] = 0;
  34. }
  35. /**
  36. * Log data from the original users table
  37. */
  38. public function log_original_course_unique_id(&$omigrate, $data) {
  39. $omigrate['courses'][$data] = 0;
  40. }
  41. /**
  42. * Log data from the original users table
  43. */
  44. public function log_original_session_unique_id(&$omigrate, $data) {
  45. $omigrate['sessions'][$data] = 0;
  46. }
  47. }