Hello,

I'm trying to add a backup migrate schedule into an installation profile.

I'm using the code below, but it isn't working. Can anyone help with this?

<?php
  $schedule = array(
    'name' => t('Default schedule'),
    'profile_id' => 'default',
    'enabled' => 1,
    'destination_id' => 'scheduled',
    'period' => 86400,
    'keep' => 7,
  );
  $schedule = backup_migrate_crud_create_item('schedule', $schedule);
  $schedule->save();
?>

Comments

jamesmorrish’s picture

Did you ever get this to work?

I managed it by adding this line above your code:

require_once('sites/all/modules/contrib/backup_migrate/includes/crud.inc');

iancawthorne’s picture

Status: Active » Fixed

Many thanks for commenting on this, I hadn't got it working until now, and adding in that extra line has done the trick! Thank you very much.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.