1

How to merge simple core content into from site a to site b. Content is created using core functionality and modules.

Let's say I have 2 Drupal 7 sites, both have same configuration and modules.

Site A has:

  • 3 content types
  • 3 taxonomies
  • 3 articles

Site B has:

  • 1 content types
  • 1 taxonomies
  • 1 articles

How do I append content of site B to site A?

I want the content from site A to be appended to site B. If I do backup migrate, the content of site A will be overwritten.

I've noticed that backup migrate can have manual selection of what to export, but it will overwrite destination right?

What is the best procedure for this?

0

No code solution:

Use Feeds to import the data. But first, you'll need to create a CSV of your data. You can use Views Data Export.

Now that you have a CSV, simply import using feeds.

0

You could always write a couple of migration classes with the Migrate module, and hook up Site B as the datasource (the module would live in Site A).

You can do this by adding Site B's database credentials to the settings.php as another configuration, then calling on that in your script.

Here is an example of what a Migration class might look like:

class YourMigration extends Migration {
  public function __construct($arguments) {
    parent::__construct($arguments);

    $query = Database::getConnection('connection_name', 'connection_key');
    // other query arguments to execute
  }
}

Where the Database::getConnection arguments are the names of the items in your $databases array in settings.php. With a working script, you can then write other scripts (or a cron job) to periodically run the migrate job.

Others will say to use Feeds, but I've always been a big Migrate fan (not Drupal2Drupal migrate module, the main Migrate module itself).

I've noticed that backup migrate can have manual selection of what to export, but it will overwrite destination right?

Pretty much. Site A would get wiped out. It also isn't as simple as moving MySQL data around, unless every data model in Site B is identical or exists in Site A even then its a fairly large technical challenge not to screw anything up. I would not do anything with SQL at this level - it needs to go through the API.

  • Thanks but....I'm not a developer...so this is way out of my league...isn't there a module or a simple way to to this in phpmyadmin or backup migrate? – Bruno Vincent Feb 12 '18 at 2:42
  • A database sync would overwrite everything. You'd still be looking at custom MySQL scripts and it is way more complicated to do at that level because then you have to account for all the tables etc - there is more going on behind the scenes when Drupal creates a node. Dozens of tables can be involved depending on various factors, also all the revision tables too. – Kevin Feb 12 '18 at 2:44
  • Feeds sounds like the only option for you then. drupal.org/project/feeds – Kevin Feb 12 '18 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.