123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- /**
- * @file
- * Mock module to help and test hooks.
- */
- /**
- * A base class for mock exportables.
- */
- class BmTestItem {
- /**
- * Edit this to true to make a default item disabled initially.
- *
- * @var bool
- */
- public $disabled = FALSE;
- /**
- * Indicates the API version to use.
- *
- * @var int
- */
- public $api_version = 1;
- }
- /**
- * Implements hook_ctools_plugin_api().
- */
- function bm_test_ctools_plugin_api($module = NULL, $api = NULL) {
- if ($module == "backup_migrate" && $api == "backup_migrate_exportables") {
- return array("version" => "1");
- }
- }
- /**
- * Implements hook_exportables_backup_migrate_schedules().
- */
- function bm_test_exportables_backup_migrate_schedules() {
- $export = array();
- $item = new BmTestItem();
- $mock_record = _bm_test_get_mock_schedule();
- foreach ($mock_record as $key => $field) {
- $item->$key = $field;
- }
- $export['mock_db_weekly'] = $item;
- return $export;
- }
- /**
- * Helper function to create a mock schedule.
- */
- function _bm_test_get_mock_schedule() {
- return array(
- 'machine_name' => 'mock_db_weekly',
- 'name' => 'Mock weekly database schedule',
- 'source_id' => 'db',
- 'destination_id' => 'scheduled',
- 'copy_destination_id' => '',
- 'profile_id' => 'default',
- 'keep' => 4,
- 'period' => 604800,
- 'enabled' => TRUE,
- 'cron' => 'builtin',
- 'cron_schedule' => '0 4 * * *',
- );
- }
- /**
- * Implements hook_exportables_backup_migrate_sources().
- */
- function bm_test_exportables_backup_migrate_sources() {
- $export = array();
- $item = new BmTestItem();
- $mock_record = _bm_test_get_mock_source();
- foreach ($mock_record as $key => $field) {
- $item->$key = $field;
- }
- $export['mock_file_directory'] = $item;
- return $export;
- }
- /**
- * Helper function to create a mock source.
- */
- function _bm_test_get_mock_source() {
- return array(
- 'machine_name' => 'mock_file_directory',
- 'name' => 'Mock file directory',
- 'location' => '/dev/null',
- 'subtype' => 'filesource',
- );
- }
- /**
- * Implements hook_exportables_backup_migrate_destinations().
- */
- function bm_test_exportables_backup_migrate_destinations() {
- $export = array();
- $item = new BmTestItem();
- $mock_record = _bm_test_get_mock_destination();
- foreach ($mock_record as $key => $field) {
- $item->$key = $field;
- }
- $export['mock_email'] = $item;
- return $export;
- }
- /**
- * Helper function to create a mock destination.
- */
- function _bm_test_get_mock_destination() {
- return array(
- 'machine_name' => 'mock_email',
- 'name' => 'Mock e-mail destination',
- 'location' => 'test@example.com',
- 'subtype' => 'email',
- );
- }
|