/** * Owner handler * * @param string $owner UUID of new owner of site * @return Workflow * @throws TerminusException */ public function setOwner($owner = null) { $new_owner = $this->user_memberships->get($owner); if ($new_owner == null) { $message = 'The owner must be a team member. Add them with `site team`'; throw new TerminusException($message); } $workflow = $this->workflows->create('promote_site_user_to_owner', array('params' => array('user_id' => $new_owner->get('id')))); return $workflow; }
/** * Update service level * * @param string $level Level to set service on site to * @return \stdClass * @throws TerminusException */ public function updateServiceLevel($level) { try { $workflow = $this->workflows->create('change_site_service_level', ['params' => ['service_level' => $level]]); } catch (\Exception $e) { if (strpos($e->getMessage(), '403') !== false) { throw new TerminusException('Instrument required to increase service level', [], 1); } throw $e; } return $workflow; }