Using OSF FieldStorage to Synchronize Existing Drupal Local Content to OSF

From OSF Wiki
Jump to: navigation, search

Sometimes there are situation where you would like to have all your local content type pages be saved into a OSF instance. This section gives you all the steps required to take an existing Drupal portal's content and to synchronize/export it into a OSF instance. This process is particularly helpful if you already have an existing site with dozens of content types and thousands of pages that you want to start managing on OSF (along with other content assets). The procedure explained here can be helpful for other usecases. For example, we already used to to migrate a OSF version 1.1 environment into a OSF 3.0 one. All the local content needed to be part of the new OSF 3.0 instance, and this method has been utilized.

Normally there are at least two reasons why we want to synchronize Drupal local content types into OSF:

  1. Because you want to stop using the FieldStorage, and want to manage all this content directly into OSF using the Entity API
  2. Because you want your local content be searchable with all the other OSF dataset assests via the OSF SearchAPI module

In any case, it is the same procedure that should be utilized.

Configuring the Local Content Synchronization Process

The first thing you have to do before performing the synchronization process is to map all the fields of the content type you want to synchronize in OSF to the classes and properties that you want to use for saving the information in OSF. To perform this mapping, you have to click on the RDF MAPPINGS tab. Then you have to make sure that all the types and properties you want to save in OSF are properly mapped:

Fieldstorage sync 2.PNG

Take note: if you didn't enable the All fields can be mapped into RDF and saved into OSF option in the OSF FieldStorage options, then you will only see the fields that uses the osf_fieldstorage field storage type. If you want to map osf_fieldstorage and field_sql_storage types, then you have to select that option, save it, and then go back to the RDF MAPPINGS tab to do the mappping of these non-osf_fieldstorage fields.

You also have to specify the dataset that will contain all the synchronized local data content. All the synchronized local content will be saved into that single dataset.

Fieldstorage sync 6.PNG

Once the mapping is complete, you have to make sure that you have at least one field that uses the osf_fieldstorage field storage type. It is necessary to have at least one to see the SYNCHRONIZE tab appearing. If you don't need any, then what you should do is to create a dummy field that uses the osf_fieldstorage type and hide it to the users afterward.

Fieldstorage sync 1.PNG

Once everything is properly configured, and that you can see and click the SYNCHRONIZE tab, then you are ready to start the synchronization process. It is as simple as clicking the Synchronize Content Type button.

Fieldstorage sync 3.PNG

Once you clicked the button, you will get into the synchronization process. All the local content will be synchronized into OSF using that process.

Fieldstorage sync 4.PNG

Then when the process ends, you will get a report that everything did go fine, with the number of pages processed.

Fieldstorage sync 5.PNG

At that point, all the data is saved into the local content dataset.