Everyone has their own way.  Due to almost always having errors (and then the resultant huge amount of QA) with module methods (Feeds, Backup and Migrate, etc.) we’ve, for the past ~10 years, have used straight PHP code to migrate data between old and new Drupal sites.  In a exceedingly simple outline:

Have old D6 site Build empty new D7 site Move all data from D6 to D7 though PHP/Drupal API calls.

# # #

My questions are:

- Does Backdrop have the same bootstrap setup? [1]

- Does Backdrop have ALL the API calls that D7 has? [2]

- If so, are they exactly the same syntax?

- If not, which are missing?

Thanks, Michael

[1]
define('DRUPAL_ROOT', getcwd()); //set DRUPAL_ROOT for Drupal
require_once './includes/bootstrap.inc'; //require the bootstrap include
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); //Load Drupal (loads everything, but doesn't render anything)

[2]
$user = user_load(2);
node_delete($NodeD6→nid);
$newNode = new stdClass();
  $newNode->uid         = $user->uid;
  $newNode->title       = $NodeD6->title;
  $newNode->status      = $NodeD6->status; //(1 or 0): published or not
  $newNode->comment     = 1; // $NodeD6->comment; // 0 = comments disabled, 1 = read only, 2 = read/write
  $newNode->promote     = 0;
  $newNode->uid         = $user->uid;
  $newNode->title       = $NodeD6->title;
  $newNode->status      = $NodeD6->status; //(1 or 0): published or not
  $newNode->comment     = 1; // $NodeD6->comment; // 0 = comments disabled, 1 = read only, 2 = read/write
  $newNode->promote     = 0;
  $newNode->sticky      = 0; // no blog(s) or mass contact should be sticky
  $newNode->nid         = $NodeD6->nid;
  $newNode->type        = 'blog_fast_track';
  $newNode->language    = 'en';
  $newNode->created     = $NodeD6->created;
  $newNode->changed     = $NodeD6->changed;
  $newNode->body['und'][0]['value']                    = $NodeD6->body;
  $newNode->body['und'][0]['summary']                  = text_summary($NodeD6->body);
  $newNode->body['und'][0]['format']                   = 'wysiwyg';

  if ( is_object($NodeD6->taxonomy) ) {
    foreach ($NodeD6->taxonomy as $taxobj) {
      $TidtoUse = map_check_and_create_taxonomy_term($taxobj->name);
      if ( ! $TidtoUse == "" ) {
        if ( $newNode->field_tags['und'][$TidtoUse]['tid'] == "" ) {
          $newNode->field_tags['und'][$TidtoUse]['tid']           = $TidtoUse;
        }
      }
    }
  }

  if ( ! $NodeD6->field_image[0]->filename == "" ) {
    $rowimg = 0;
    foreach ($NodeD6->field_image as $imgobj) {
      $file_to_save = $D6_base_path . '/' . $imgobj->filepath;
      $file_contents  = file_get_contents($file_to_save);
      $file_sch_loc = file_default_scheme() . '://' . $imgobj->filename;
      $file_temp = file_save_data($file_contents, $file_sch_loc, FILE_EXISTS_REPLACE);
      $newNode->field_image_fast_track['und'][$rowimg] = (array) $file_temp;
      $rowimg++;
    }
  }

  $newNode->is_new      = TRUE;
  return $newNode;
etc.

Comments

klonos's picture

Hey ,

I don't have a yes/no answer for you currently, but I would say that you should be able to test this fairly quickly, if you consider the following:

1. All core files in Backdrop have been moved to a /core directory in the docroot (so you should change lines like this:

require_once './includes/bootstrap.inc'; 

to this:

require_once './core/includes/bootstrap.inc';

2. Replace all instances of drupal with backdrop (for example BACKDROP_BOOTSTRAP_FULL instead of DRUPAL_BOOTSTRAP_FULL) - same goes with function names etc.

...as for API calls, their syntax etc., I would say check https://api.backdropcms.org. We have been very careful to retain as much backwards compatibility as possible, and when functions/constants have been renamed/changed/deprecated, we made sure to include backwards-compatible wrappers that map them the old ones to the new (see https://api.backdropcms.org/api/backdrop/1/search/DRUPAL_BOOTSTRAP_FULL for example).

https://api.backdropcms.org/change-records is a good place to start looking too.

That's it for now; I'm sure that someone will come with a better answer than mine soon 😅