Hello,

Do you know if a node export module or something like that exits for drupal 8 ? Because i want to migrate content from d8 site to an other d8 site.

Any idea ?

Thanks.

Comments

Shashwat Purav’s picture

Try D8 Features module.

Thank You,
Shashwat Purav

cofaure’s picture

Hey thanks but how can I use it to export my files to my other drupal site ?

Enes’s picture

I have this problem.
İs there solution _?

bloomt’s picture

Anyone figure out a solution?

Thomas E. Bloom

Jordiaz’s picture

May be what your are looking for is a domain access module, that let you share a single db for multi-sites.
https://www.drupal.org/project/domain

cofaure’s picture

I finally create a php script to do it, but it's not really the good way to do this, anyway i'm not using the script anymore because i don't need to export now

saylee’s picture

Hey Hi,

I am looking for same solution to migrate Drupal 8 node content to another site. I have tried Feature module but it will only migrate configuration changes. Can any one help me in this. Also if possible can please share PHP script that you have created? Probably I can modify it as per my requirement.

Thanks in Advance :)

cofaure’s picture

Hi :) i think its really not the best choice to do it, its not clean, but ill show you my PHP, i don't remember if it's working but you can be inspired by it :

<?php


//your bdds
$bdd1 = new PDO('');
$bdd2 = new PDO('');






//copy lines 
$requete2 = $bdd1->query("SELECT title FROM node_field_data");
$res2 = $requete2->fetchAll();
 
$list_ids = array();
foreach($res2 as $row2){
 $list_ids[] = $row2['title'];
}

$list_ids =  ( !empty($list_ids) )? implode( '","', $list_ids) : ''; 
$list_ids = '"'.$list_ids.'"';


// Transfer content that they dont have the same title

  use Drupal\Core\DrupalKernel;
  use Symfony\Component\HttpFoundation\Request;

  $autoloader = require_once 'autoload.php';

  $kernel = new DrupalKernel('prod', $autoloader);

  $request = Request::createFromGlobals();
  $response = $kernel->handle($request);
 //  $response->send();

  use Drupal\node\Entity\Node;
  use \Drupal\file\Entity\File;
$caracteristiques = $bdd2->query("SELECT node.type, node__body.langcode, title, body_value, body_format FROM node, node__body, node_field_data WHERE node.nid=node__body.entity_id AND node_field_data.nid=node.nid AND node_field_data.title NOT IN (".$list_ids.")");
					

while($carac=$caracteristiques->fetch()){
    $node = Node::create([
   'type' => $carac['type'],
  'langcode' => 'en',
  'created' => REQUEST_TIME,
  'changed' => REQUEST_TIME,
  'uid' => 1,
  'title' => $carac['title'],
  'body' => [
    'summary' => '',
    'value' => $carac['body_value'],
    'format' => 'full_html',
  ],
]);

  $node->save();
$titre = $carac['title'];
$req=$bdd1->query("UPDATE node_field_data SET status = '0' WHERE title='".$titre."'");
$req2=$bdd1->query("UPDATE node_field_revision SET status = '0' WHERE title='".$titre."'");
}

Their is certainly some errors, but the goal was to create on your other drupal bdd the content who are not existing (by titles)

saylee’s picture

Thnak you for sharing :)

robert.stankevich’s picture

Hi, looks like my issue. While I do some updates and modifications in my development environment, content managers still work with sites in production. As a result, after updates are done, i have to add new content manually. Sometimes it's just a couple of nodes, so, not a big deal. Yet some updates take much more time, and as a result more content to add. Don't think that manual merging of databases is a good solution.

brandonratz’s picture

Have you looked into the DCD project? "...provides content deployment and allows development and building sites without the need to transfer database between the sites."

https://www.drupal.org/project/default_content_deploy

wavesailor’s picture

Is there no simple solution?

Like the Drupal 7 Node Export?

cestmoi’s picture

i want to migrate content from d8 site to an other d8 site

I'm looking for same.

I'd migrated a D6 site to a D8 and finally made it work after lots of issues along the way. However, I'm planning on making a fresh D8 install and importing the content and users into from the first one. It would be so nice to have an export/import module where one can move content from one D8 to another.

I'm currently researching available options and hopefully find something clean and to the point.

Edit: sorry, my comment was meant to the original post.