You are here

function acquia_lift_target_set_status in Acquia Lift Connector 7.2

Update the status of an acquia lift target agent and synchronize any necessary configuration to Lift.

Parameters

stdClass $agent_data: The agent to update and synchronize if necessary.

$next_status: The new status for the agent.

Return value

bool True if the synchronization and status changes were successful.

3 calls to acquia_lift_target_set_status()
AcquiaLiftWebTestCampaignWizardReview::testReviewSubmit in tests/acquia_lift.test
Tests the submission of the review form which results in nested tests being created.
acquia_lift_personalize_campaign_wizard_review_submit in ./acquia_lift.admin.wizard.inc
Submit function for the review page.
acquia_lift_personalize_campaign_wizard_status_submit in ./acquia_lift.admin.wizard.inc
Submit function for the status change buttons.

File

./acquia_lift.admin.inc, line 2050
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_target_set_status($agent_data, $next_status) {
  if ($agent_data->plugin !== 'acquia_lift_target') {
    personalize_agent_set_status($agent_data->machine_name, $next_status);
    return TRUE;
  }
  if ($next_status == PERSONALIZE_STATUS_RUNNING || $next_status == PERSONALIZE_STATUS_SCHEDULED) {
    module_load_include('inc', 'acquia_lift', 'acquia_lift.batch');
    try {
      acquia_lift_implement_test_structure($agent_data);
      acquia_lift_batch_sync_tests_for_agent($agent_data, $next_status);

      // Unset the started property which will have been changed during
      // status update and we don't want it getting clobbered by other
      // saves of the agent.
      unset($agent_data->started);
      return TRUE;
    } catch (Exception $e) {
      watchdog('Acquia Lift', $e
        ->getMessage());
      return FALSE;
    }
  }
  else {
    return personalize_agent_set_status($agent_data->machine_name, $next_status);
  }
}