Example #1
0
 /**
  * 
  * @return SS_HTTPResponse
  */
 protected function createPing()
 {
     if (!$this->record->canDeploy($this->getMember())) {
         return $this->message('You are not authorized to do that on this environment', 403);
     }
     $ping = new DNPing();
     $ping->EnvironmentID = $this->record->ID;
     $ping->write();
     $ping->start();
     $location = Director::absoluteBaseURL() . $this->Link() . '/ping/' . $ping->ID;
     $output = array('message' => 'Ping queued as job ' . $ping->ResqueToken, 'href' => $location);
     $response = $this->getAPIResponse($output);
     $response->setStatusCode(201);
     $response->addHeader('Location', $location);
     return $response;
 }