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

I will try to make it myself :)



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,
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
new2.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);