You are here

function salesforce_pull_drush_command in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_pull/salesforce_pull.drush.inc \salesforce_pull_drush_command()
  2. 5.0.x modules/salesforce_pull/salesforce_pull.drush.inc \salesforce_pull_drush_command()

Implements hook_drush_command().

File

modules/salesforce_pull/salesforce_pull.drush.inc, line 15
Salesforce Pull drush 8 commands.

Code

function salesforce_pull_drush_command() {
  $items['sf-pull-query'] = [
    'category' => 'salesforce',
    'description' => 'Given a mapping, enqueue records for pull from Salesforce, ignoring modification timestamp. This command is useful, for example, when seeding content for a Drupal site prior to deployment.',
    'aliases' => [
      'sfpq',
      'sfiq',
    ],
    'arguments' => [
      'name' => 'Machine name of the Salesforce Mapping for which to queue pull records.',
    ],
    'options' => [
      'where' => [
        'description' => 'A WHERE clause to add to the SOQL pull query. Default behavior is to query and pull all records.',
      ],
      'start' => 'strtotime()able string for the start timeframe over which to pull, e.g. "-5 hours". If omitted, use the value given by the mapping\'s pull timestamp. Must be in the past.',
      'stop' => 'strtotime()able string for the end timeframe over which to pull, e.g. "-5 hours". If omitted, defaults to "now". Must be "now" or earlier',
      'force-pull' => 'if given, force all queried records to be pulled regardless of updated timestamps. If omitted, only Salesforce records which are newer than linked Drupal records will be pulled.',
    ],
    'examples' => [
      'drush sfpq user' => 'Query and queue all records for "user" Salesforce mapping.',
      'drush sfpq user --where="Email like \'%foo%\' AND (LastName = \'bar\' OR FirstName = \'bar\')"' => 'Query and queue all records for "user" Salesforce mapping with Email field containing the string "foo" and First or Last name equal to "bar"',
      'drush sfpq' => 'Fetch and process all pull queue items',
      'drush sfpq --start="-25 minutes" --stop="-5 minutes"' => 'Fetch updated records for all mappings between 25 minutes and 5 minutes old, and process them.',
      'drush sfpq foo --start="-25 minutes" --stop="-5 minutes"' => 'Fetch updated records for mapping "foo" between 25 minutes and 5 minutes old, and process them.',
    ],
  ];
  $items['sf-pull-file'] = [
    'category' => 'salesforce',
    'description' => 'Given a mapping, enqueue a list of object IDs to be pulled from a CSV file, e.g. a Salesforce report. The first column of the CSV file must be SFIDs. Additional columns will be ignored.',
    'aliases' => [
      'sfpf',
      'sfif',
    ],
    'arguments' => [
      'file' => 'CSV file name of 15- or 18-character Salesforce ids to be pulled. ',
      'name' => 'Machine name of the Salesforce Mapping for which to queue pull records.',
    ],
  ];
  $items['sf-pull-reset'] = [
    'category' => 'salesforce',
    'description' => 'Reset pull timestamps for one or all Salesforce Mappings, and set all mapped objects to be force-pulled.',
    'arguments' => [
      'name' => [
        'description' => 'Machine name of the Salesforce Mapping for which to reset pull timestamps.',
      ],
    ],
    'options' => [
      'delete' => 'Reset delete date timestamp (instead of pull date timestamp)',
    ],
    'examples' => [
      'drush sf-pull-reset' => 'Reset pull timestamps for all mappings.',
      'drush sf-pull-reset foo' => 'Reset pull timestamps for mapping "foo"',
      'drush sf-pull-reset --delete' => 'Reset "delete" timestamps for all mappings',
      'drush sf-pull-reset foo --delete' => 'Reset "delete" timestamp for mapping "foo"',
    ],
  ];
  $items['sf-pull-set'] = [
    'category' => 'salesforce',
    'description' => 'Set pull timestamp on a single Salesforce Mappings to a specific point in history (or now).',
    'arguments' => [
      'name' => [
        'description' => 'Machine name of the Salesforce Mapping for which to reset pull timestamps.',
      ],
      'time' => [
        'description' => 'Timestamp to set the value to. Defaults to the runtime.',
      ],
    ],
    'examples' => [
      'drush sf-pull-set foo' => 'Set pull timestamps for mapping "foo" to "now"',
      'drush sf-pull-set foo 1517416761' => 'Set pull timestamps for mapping "foo" to Jan 31, 2018, around 8:40am time in Portland, OR',
    ],
  ];
  return $items;
}