I would like to have support for http://drupal.org/project/scheduler

I will try to make it myself :)

Members fund testing for the Drupal project. Drupal Association Learn more


Kasper Souren’s picture

Title: scheduler support » migrate support for scheduler
Project: Migrate Extras » Scheduler
Version: 7.x-2.1 » 7.x-1.0
Component: Migrate Extras Features » Code

Now reading README.txt "The ideal place to implement migration support for a contributed module is in that module."

Kasper Souren’s picture

Status: Active » Needs work

I have some basic code here but I'm not sure how it should be best added to the Scheduler module.
I guess it should be called scheduler.migrate.inc and scheduler.info needs a line files[] = scheduler.migrate.inc but I'm not sure.

 * @file
 * Support for the Scheduler module.

 * Field handler.
class MigrateSchedulerHandler extends MigrateDestinationHandler {
  public function __construct() {

   * Make the destination field visible.
  public function fields() {
    return array(
      'scheduler' =>
        t('Scheduler: scheduler_publish_on  publishing date for scheduler'),

  public function prepare($entity, stdClass $row) {
    if (isset($row->scheduler_publish_on)) {

      $entity->status = 0;
      $entity->publish_on = $row->scheduler_publish_on;
mikeryan’s picture

Yes, you should put that into scheduler.migrate.inc, reference it in .info, and also add

function scheduler_migrate_api() {
  $api = array(
    'api' => 2,
  return $api;
vomiand’s picture

Project: Scheduler » Migrate Extras
Version: 7.x-1.0 » 7.x-2.x-dev
Component: Code » Migrate Extras Features
Status: Needs work » Needs review
2.1 KB

Added support for scheduler.

jonathan1055’s picture

Title: migrate support for scheduler » Migrate support for scheduler

Hi Vomiand,

Your patch is creating a new file scheduler.inc in the migrate_extras folder, but according to MikeRyan in #3 this should be in the Scheduler folder.

Also what about the code snippet in #3? Does that go into scheduler.migrate.inc or scheduler.module?

(Scheduler support)

[edit: correction to details of what the patch is doing]

jonathan1055’s picture

Status: Needs review » Needs work

Now that we have a new (and active) co-maintainer for Scheduler, we will be happy to implement this, when it is fully reviewed and tested.


pieter_duijves’s picture

correct me if i'm wrong, but migrating (un)publish dates (for the scheduler module) into Drupal through the migrate module seems to work out-of-the-box for me.

  $this->addFieldMapping('publish_on', 'publish_timestamp');
  $this->addFieldMapping('unpublish_on', 'unpublish_timestamp');

quick proof of concept:



you might need to map your source date to a timestamp in prepareRow(), eg:

class MyCustomMigration extends DynamicMigration {


  public function prepareRow($row) {

    // Always include this fragment at the beginning of every prepareRow()
    // implementation, so parent classes can ignore rows.
    if (parent::prepareRow($row) === FALSE) {
      return FALSE;

    if (isset($row->some_publish_date)) {
      $row->publish_timestamp = strtotime($row->some_publish_date);

    if (isset($row->some_unpublish_date)) {
      $row->unpublish_timestamp = strtotime($row->some_unpublish_date);


brooke_heaton’s picture

No I do not see this working out of the box. I do not see any destination fields for publish_on or unpublish_on. I may be missing something.

"publish_timestamp" was used as source field in the "publish_on" mapping but is not in list of source fields
"publish_on" was used as destination field in "publish_timestamp" mapping but is not in list of destination fields
"unpublish_timestamp" was used as source field in the "unpublish_on" mapping but is not in list of source fields
"unpublish_on" was used as destination field in "unpublish_timestamp" mapping but is not in list of destination fields