Example #1
0
 /**
  * Decodes and validates the data from bitbucket and calls the 
  * deploy constructor to deploy the new code.
  *
  * @param 	string 	$payload 	The JSON encoded payload data.
  */
 function __construct($payload)
 {
     $payload = json_decode(stripslashes($_POST['payload']), true);
     $name = $payload['repository']['name'];
     $this->log($payload['commits'][0]['branch']);
     if (isset(parent::$repos[$name]) && parent::$repos[$name]['branch'] === $payload['commits'][0]['branch']) {
         $data = parent::$repos[$name];
         $data['commit'] = $payload['commits'][0]['node'];
         parent::__construct($name, $data);
     }
 }
Example #2
0
 /**
  * Decodes and validates the data from github and calls the 
  * deploy constructor to deploy the new code.
  *
  * @param   string  $_payload   The JSON encoded payload data.
  * @param   array   $headers    Array with all the HTTP headers from the current request.
  */
 function __construct($_payload, $headers)
 {
     $payload = json_decode($_payload);
     $name = $payload->repository->name;
     $branch = basename($payload->ref);
     $commit = substr($payload->commits[0]->id, 0, 12);
     if (isset(parent::$repos[$name]) && parent::$repos[$name]['branch'] === $branch) {
         $data = parent::$repos[$name];
         $data['commit'] = $commit;
         parent::__construct($name, $data, $_payload, $headers);
     }
 }