Guest User

Untitled

a guest
Jan 22nd, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. id: mom_files
  2. label: Files for Media
  3. migration_group: mom
  4. source:
  5. plugin: mom_files
  6. constants:
  7. source_base_path: 'sites/default/files/'
  8. old_files_path: 'sites/default/files/migration-files/'
  9. process:
  10. filename: id
  11. source_full_path:
  12. -
  13. plugin: concat
  14. delimiter: /
  15. source:
  16. - constants/old_files_path
  17. - filepath
  18. -
  19. plugin: urlencode
  20. uri:
  21. plugin: file_copy
  22. source:
  23. - '@source_full_path'
  24. - uri
  25. created:
  26. plugin: callback
  27. source: created
  28. callable: strtotime
  29. changed: '@created'
  30. fid: id
  31.  
  32. destination:
  33. plugin: entity:file
  34. migration_dependencies:
  35. required:
  36. - mom_teachers
  37.  
  38. <?php
  39.  
  40. namespace Drupalmom_migratePluginmigratesource;
  41.  
  42. use DrupalmigratePluginmigratesourceSqlBase;
  43. use DrupalmigrateRow;
  44.  
  45. /**
  46. * Source plugin for Mom files.
  47. *
  48. * @MigrateSource(
  49. * id = "mom_files",
  50. * )
  51. */
  52. class MomFiles extends SqlBase {
  53.  
  54. /**
  55. * {@inheritdoc}
  56. */
  57. public function query() {
  58. $query = $this->select('images', 'im')
  59. ->fields('im', ['id', 'created']);
  60.  
  61. return $query;
  62. }
  63.  
  64. /**
  65. * {@inheritdoc}
  66. */
  67. public function prepareRow(Row $row) {
  68. if ($value = $row->getSourceProperty('id')) {
  69. $row->setSourceProperty('filename', $id);
  70. $row->setSourceProperty('uri', substr($id, -1) . '/');
  71. }
  72. return parent::prepareRow($row);
  73. }
  74.  
  75. /**
  76. * {@inheritdoc}
  77. */
  78. public function fields() {
  79. return array(
  80. 'id' => $this->t('File ID'),
  81. 'filename' => $this->t('File name'),
  82. 'uri' => $this->t('The URI to access the file'),
  83. 'created' => $this->t('The time that the file was added.'),
  84. );
  85. }
  86.  
  87. /**
  88. * {@inheritdoc}
  89. */
  90. public function getIds() {
  91. $ids['id']['type'] = 'integer';
  92. return $ids;
  93. }
  94.  
  95. }
  96.  
  97. User error: "1" is an invalid render array key in DrupalCoreRenderElement::children() (line 97 of /var/www/html/media/core/lib/Drupal/Core/Render/Element.php)
  98.  
  99. Could not create or write to directory ''
Add Comment
Please, Sign In to add comment