Skip to content
Snippets Groups Projects

Blog migration review

Merged Brendan Blaine requested to merge migrate-blogs into 7.x-1.x

Initial commit for drumm's review to see if this is the right direction and make the review process easier with MR tools.

Merge request reports

Merged by Neil DrummNeil Drumm 2 months ago (Feb 25, 2025 11:15pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Neil Drumm
  • Neil Drumm
  • Neil Drumm
  • Neil Drumm
  • Neil Drumm
  • added 1 commit

    • 02496c86 - Suggestion from Neil, check for promote to front page instead of node type...

    Compare with previous version

  • Brendan Blaine added 2 commits

    added 2 commits

    • cb607b07 - Removed useless comment gathering, fix some logic surrounding this change
    • 2d6bfe56 - Formatting

    Compare with previous version

  • added 1 commit

    • 662e9316 - Use drupalorg uid for comment author uid

    Compare with previous version

  • added 1 commit

    • c84e0f08 - Changing structure, query names for clarity, uid finding

    Compare with previous version

  • Neil Drumm
  • Neil Drumm
  • added 1 commit

    • eef39912 - Refactored how comments attach to blog data in both logic and structure

    Compare with previous version

  • Neil Drumm resolved all threads

    resolved all threads

  • This looks all good for now. I'll hold off on merging, since developing the import will be a good way to find something we didn't think about.

    Files are the next thing to think about migrating, a good number of these have images attached. To start, maybe add the array of public URLs of the files to the export, like https://assoc.drupal.org/files/Drupal8Mens_1.png for https://assoc.drupal.org/blog/eliseh1280/buy-gift-drupal

    We can copy the files over on a batch server, so the actual files don't need to be transferred. That post does have <img alt="" src="https://assoc.drupal.org/files/Drupal8Mens_1.png", so at least the domain name will have to be taken out. If there are a lot of collisions, we might put them in a subdirectory like /files/association-archive/Drupal8Mens_1.png. Can think about that once we have a list and see what there is.

  • added 1 commit

    • 99af5a7e - Create a list of image urls from blog body content and export the list so we...

    Compare with previous version

  • Thanks so much Neil. On dev I've found 598 images, mostly from assoc.drupal.org but there are quite a few from other places. I'll commit the code I used to get the list here shortly.

    edit: I hit push before I'd clicked "comment"

    Edited by Brendan Blaine
  • added 1 commit

    • 2c43e1a1 - Put image data into it's own json_encode()

    Compare with previous version

  • added 1 commit

    • 8a63399e - Capture files uploaded to blog posts

    Compare with previous version

  • 70 $comment_nodes = comment_load_multiple(array_keys($comment_result['comment']));
    71
    72 $blog_data = [];
    73 foreach (node_load_multiple(array_keys($result['node'])) as $nid => $blog) {
    74 if ($blog->status == 1) {
    75 $blog_data[$nid]['title'] = $blog->title;
    76 $blog_data[$nid]['name'] = $blog->name;
    77 $blog_data[$nid]['created'] = $blog->created;
    78 $blog_data[$nid]['changed'] = $blog->changed;
    79 $blog_data[$nid]['body'] = $blog->body[LANGUAGE_NONE][0]['value'];
    80 if(!empty($blog->upload)) {
    81 $blog_data[$nid]['files'] = $blog->upload;
    82 }
    83
    84 // Extract all image urls from the body and put them in an array
    85 $regex = '/https?:\/\/[^"\']+\.(?:jpg|jpeg|gif|png|webp|svg)/i';
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading