@@ -7,101 +7,101 @@ |
||
7 | 7 | class EmailMessagingService implements ConfirmationMessagingService |
8 | 8 | { |
9 | 9 | |
10 | - /** |
|
11 | - * @config |
|
12 | - * @var string |
|
13 | - */ |
|
14 | - private static $default_from = '[email protected]'; |
|
10 | + /** |
|
11 | + * @config |
|
12 | + * @var string |
|
13 | + */ |
|
14 | + private static $default_from = '[email protected]'; |
|
15 | 15 | |
16 | - /** |
|
17 | - * @config |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - private static $default_subject = 'Deploynaut notification'; |
|
16 | + /** |
|
17 | + * @config |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + private static $default_subject = 'Deploynaut notification'; |
|
21 | 21 | |
22 | - public function sendMessage($source, $message, $recipients, $arguments = array()) |
|
23 | - { |
|
24 | - $from = empty($arguments['from']) |
|
25 | - ? Config::inst()->get(get_class($this), 'default_from') |
|
26 | - : $arguments['from']; |
|
27 | - $subject = empty($arguments['subject']) |
|
28 | - ? Config::inst()->get(get_class($this), 'default_subject') |
|
29 | - : $arguments['subject']; |
|
22 | + public function sendMessage($source, $message, $recipients, $arguments = array()) |
|
23 | + { |
|
24 | + $from = empty($arguments['from']) |
|
25 | + ? Config::inst()->get(get_class($this), 'default_from') |
|
26 | + : $arguments['from']; |
|
27 | + $subject = empty($arguments['subject']) |
|
28 | + ? Config::inst()->get(get_class($this), 'default_subject') |
|
29 | + : $arguments['subject']; |
|
30 | 30 | |
31 | - // Split users and send individually |
|
32 | - $this->sendIndividualMessages($source, $message, $recipients, $from, $subject); |
|
33 | - } |
|
31 | + // Split users and send individually |
|
32 | + $this->sendIndividualMessages($source, $message, $recipients, $from, $subject); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Separates recipients into individual users |
|
37 | - * |
|
38 | - * @param PipelineStep $source Source client step |
|
39 | - * @param string $message Plain text message |
|
40 | - * @param mixed $recipients Either a Member object, string, or array of strings or Member objects |
|
41 | - * @param string $from |
|
42 | - * @param string $subject |
|
43 | - * @return boolean True if success |
|
44 | - */ |
|
45 | - protected function sendIndividualMessages($source, $message, $recipients, $from, $subject) |
|
46 | - { |
|
47 | - // Split recipients that are comma separated |
|
48 | - if (is_string($recipients) && stripos($recipients, ',')) { |
|
49 | - $recipients = explode(',', $recipients); |
|
50 | - return $this->sendIndividualMessages($source, $message, $recipients, $from, $subject); |
|
51 | - } |
|
35 | + /** |
|
36 | + * Separates recipients into individual users |
|
37 | + * |
|
38 | + * @param PipelineStep $source Source client step |
|
39 | + * @param string $message Plain text message |
|
40 | + * @param mixed $recipients Either a Member object, string, or array of strings or Member objects |
|
41 | + * @param string $from |
|
42 | + * @param string $subject |
|
43 | + * @return boolean True if success |
|
44 | + */ |
|
45 | + protected function sendIndividualMessages($source, $message, $recipients, $from, $subject) |
|
46 | + { |
|
47 | + // Split recipients that are comma separated |
|
48 | + if (is_string($recipients) && stripos($recipients, ',')) { |
|
49 | + $recipients = explode(',', $recipients); |
|
50 | + return $this->sendIndividualMessages($source, $message, $recipients, $from, $subject); |
|
51 | + } |
|
52 | 52 | |
53 | - // Iterate through arrays |
|
54 | - if (is_array($recipients) || $recipients instanceof SS_List) { |
|
55 | - foreach ($recipients as $recipient) { |
|
56 | - $this->sendIndividualMessages($source, $message, $recipient, $from, $subject); |
|
57 | - } |
|
58 | - return true; |
|
59 | - } |
|
53 | + // Iterate through arrays |
|
54 | + if (is_array($recipients) || $recipients instanceof SS_List) { |
|
55 | + foreach ($recipients as $recipient) { |
|
56 | + $this->sendIndividualMessages($source, $message, $recipient, $from, $subject); |
|
57 | + } |
|
58 | + return true; |
|
59 | + } |
|
60 | 60 | |
61 | - if ($recipients) { |
|
62 | - $this->sendMessageTo($source, $from, $recipients, $subject, $message); |
|
63 | - return true; |
|
64 | - } |
|
61 | + if ($recipients) { |
|
62 | + $this->sendMessageTo($source, $from, $recipients, $subject, $message); |
|
63 | + return true; |
|
64 | + } |
|
65 | 65 | |
66 | - // Can't send to empty recipient |
|
67 | - return false; |
|
68 | - } |
|
66 | + // Can't send to empty recipient |
|
67 | + return false; |
|
68 | + } |
|
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * Send an message to a single recipient |
|
73 | - * |
|
74 | - * @param PipelineStep $source Client step |
|
75 | - * @param string $from |
|
76 | - * @param string|Member $to |
|
77 | - * @param string $subject |
|
78 | - * @param string $body |
|
79 | - */ |
|
80 | - protected function sendMessageTo($source, $from, $to, $subject, $body) |
|
81 | - { |
|
82 | - if ($to instanceof Member) { |
|
83 | - $to = $to->Email; |
|
84 | - } |
|
85 | - $this->sendViaEmail($source, $from, $to, $subject, $body); |
|
86 | - } |
|
71 | + /** |
|
72 | + * Send an message to a single recipient |
|
73 | + * |
|
74 | + * @param PipelineStep $source Client step |
|
75 | + * @param string $from |
|
76 | + * @param string|Member $to |
|
77 | + * @param string $subject |
|
78 | + * @param string $body |
|
79 | + */ |
|
80 | + protected function sendMessageTo($source, $from, $to, $subject, $body) |
|
81 | + { |
|
82 | + if ($to instanceof Member) { |
|
83 | + $to = $to->Email; |
|
84 | + } |
|
85 | + $this->sendViaEmail($source, $from, $to, $subject, $body); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * Send an email to a single recipient |
|
90 | - * |
|
91 | - * @param PipelineStep $source Client step |
|
92 | - * @param string $from |
|
93 | - * @param string $to |
|
94 | - * @param string $subject |
|
95 | - * @param string $body |
|
96 | - */ |
|
97 | - protected function sendViaEmail($source, $from, $to, $subject, $body) |
|
98 | - { |
|
99 | - $email = new Email($from, $to, $subject, $body); |
|
100 | - if ($source->getDryRun()) { |
|
101 | - $source->log("[Skipped] Sent message to $to (subject: $subject)"); |
|
102 | - } else { |
|
103 | - $email->sendPlain(); |
|
104 | - $source->log("Sent message to $to (subject: $subject)"); |
|
105 | - } |
|
106 | - } |
|
88 | + /** |
|
89 | + * Send an email to a single recipient |
|
90 | + * |
|
91 | + * @param PipelineStep $source Client step |
|
92 | + * @param string $from |
|
93 | + * @param string $to |
|
94 | + * @param string $subject |
|
95 | + * @param string $body |
|
96 | + */ |
|
97 | + protected function sendViaEmail($source, $from, $to, $subject, $body) |
|
98 | + { |
|
99 | + $email = new Email($from, $to, $subject, $body); |
|
100 | + if ($source->getDryRun()) { |
|
101 | + $source->log("[Skipped] Sent message to $to (subject: $subject)"); |
|
102 | + } else { |
|
103 | + $email->sendPlain(); |
|
104 | + $source->log("Sent message to $to (subject: $subject)"); |
|
105 | + } |
|
106 | + } |
|
107 | 107 | } |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | protected function sendIndividualMessages($source, $message, $recipients, $from, $subject) |
46 | 46 | { |
47 | 47 | // Split recipients that are comma separated |
48 | - if (is_string($recipients) && stripos($recipients, ',')) { |
|
48 | + if(is_string($recipients) && stripos($recipients, ',')) { |
|
49 | 49 | $recipients = explode(',', $recipients); |
50 | 50 | return $this->sendIndividualMessages($source, $message, $recipients, $from, $subject); |
51 | 51 | } |
52 | 52 | |
53 | 53 | // Iterate through arrays |
54 | - if (is_array($recipients) || $recipients instanceof SS_List) { |
|
55 | - foreach ($recipients as $recipient) { |
|
54 | + if(is_array($recipients) || $recipients instanceof SS_List) { |
|
55 | + foreach($recipients as $recipient) { |
|
56 | 56 | $this->sendIndividualMessages($source, $message, $recipient, $from, $subject); |
57 | 57 | } |
58 | 58 | return true; |
59 | 59 | } |
60 | 60 | |
61 | - if ($recipients) { |
|
61 | + if($recipients) { |
|
62 | 62 | $this->sendMessageTo($source, $from, $recipients, $subject, $message); |
63 | 63 | return true; |
64 | 64 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function sendMessageTo($source, $from, $to, $subject, $body) |
81 | 81 | { |
82 | - if ($to instanceof Member) { |
|
82 | + if($to instanceof Member) { |
|
83 | 83 | $to = $to->Email; |
84 | 84 | } |
85 | 85 | $this->sendViaEmail($source, $from, $to, $subject, $body); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | protected function sendViaEmail($source, $from, $to, $subject, $body) |
98 | 98 | { |
99 | 99 | $email = new Email($from, $to, $subject, $body); |
100 | - if ($source->getDryRun()) { |
|
100 | + if($source->getDryRun()) { |
|
101 | 101 | $source->log("[Skipped] Sent message to $to (subject: $subject)"); |
102 | 102 | } else { |
103 | 103 | $email->sendPlain(); |
@@ -4,8 +4,7 @@ discard block |
||
4 | 4 | * @package deploynaut |
5 | 5 | * @subpackage control |
6 | 6 | */ |
7 | -class EmailMessagingService implements ConfirmationMessagingService |
|
8 | -{ |
|
7 | +class EmailMessagingService implements ConfirmationMessagingService { |
|
9 | 8 | |
10 | 9 | /** |
11 | 10 | * @config |
@@ -19,8 +18,7 @@ discard block |
||
19 | 18 | */ |
20 | 19 | private static $default_subject = 'Deploynaut notification'; |
21 | 20 | |
22 | - public function sendMessage($source, $message, $recipients, $arguments = array()) |
|
23 | - { |
|
21 | + public function sendMessage($source, $message, $recipients, $arguments = array()) { |
|
24 | 22 | $from = empty($arguments['from']) |
25 | 23 | ? Config::inst()->get(get_class($this), 'default_from') |
26 | 24 | : $arguments['from']; |
@@ -42,8 +40,7 @@ discard block |
||
42 | 40 | * @param string $subject |
43 | 41 | * @return boolean True if success |
44 | 42 | */ |
45 | - protected function sendIndividualMessages($source, $message, $recipients, $from, $subject) |
|
46 | - { |
|
43 | + protected function sendIndividualMessages($source, $message, $recipients, $from, $subject) { |
|
47 | 44 | // Split recipients that are comma separated |
48 | 45 | if (is_string($recipients) && stripos($recipients, ',')) { |
49 | 46 | $recipients = explode(',', $recipients); |
@@ -77,8 +74,7 @@ discard block |
||
77 | 74 | * @param string $subject |
78 | 75 | * @param string $body |
79 | 76 | */ |
80 | - protected function sendMessageTo($source, $from, $to, $subject, $body) |
|
81 | - { |
|
77 | + protected function sendMessageTo($source, $from, $to, $subject, $body) { |
|
82 | 78 | if ($to instanceof Member) { |
83 | 79 | $to = $to->Email; |
84 | 80 | } |
@@ -94,8 +90,7 @@ discard block |
||
94 | 90 | * @param string $subject |
95 | 91 | * @param string $body |
96 | 92 | */ |
97 | - protected function sendViaEmail($source, $from, $to, $subject, $body) |
|
98 | - { |
|
93 | + protected function sendViaEmail($source, $from, $to, $subject, $body) { |
|
99 | 94 | $email = new Email($from, $to, $subject, $body); |
100 | 95 | if ($source->getDryRun()) { |
101 | 96 | $source->log("[Skipped] Sent message to $to (subject: $subject)"); |
@@ -3,85 +3,85 @@ |
||
3 | 3 | class PipelineController extends Controller |
4 | 4 | { |
5 | 5 | |
6 | - private static $allowed_actions = array( |
|
7 | - 'abort', |
|
8 | - 'log', |
|
9 | - 'step' |
|
10 | - ); |
|
6 | + private static $allowed_actions = array( |
|
7 | + 'abort', |
|
8 | + 'log', |
|
9 | + 'step' |
|
10 | + ); |
|
11 | 11 | |
12 | - protected $controller = null; |
|
12 | + protected $controller = null; |
|
13 | 13 | |
14 | - protected $pipeline = null; |
|
14 | + protected $pipeline = null; |
|
15 | 15 | |
16 | - public function __construct($controller, Pipeline $pipeline) |
|
17 | - { |
|
18 | - $this->controller = $controller; |
|
19 | - parent::__construct(); |
|
20 | - $this->pipeline = $pipeline; |
|
21 | - } |
|
16 | + public function __construct($controller, Pipeline $pipeline) |
|
17 | + { |
|
18 | + $this->controller = $controller; |
|
19 | + parent::__construct(); |
|
20 | + $this->pipeline = $pipeline; |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * Shows status of this pipeline |
|
25 | - */ |
|
26 | - public function index() |
|
27 | - { |
|
28 | - return $this->controller->customise(new ArrayData(array( |
|
29 | - 'Pipeline' => $this->pipeline |
|
30 | - )))->renderWith('DNRoot_pipeline'); |
|
31 | - } |
|
23 | + /** |
|
24 | + * Shows status of this pipeline |
|
25 | + */ |
|
26 | + public function index() |
|
27 | + { |
|
28 | + return $this->controller->customise(new ArrayData(array( |
|
29 | + 'Pipeline' => $this->pipeline |
|
30 | + )))->renderWith('DNRoot_pipeline'); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Get log for this pipeline |
|
35 | - */ |
|
36 | - public function log() |
|
37 | - { |
|
38 | - $log = $this->pipeline->getLogger(); |
|
39 | - if ($log->exists()) { |
|
40 | - $content = $log->content(); |
|
41 | - } else { |
|
42 | - $content = 'Waiting for action to start'; |
|
43 | - } |
|
33 | + /** |
|
34 | + * Get log for this pipeline |
|
35 | + */ |
|
36 | + public function log() |
|
37 | + { |
|
38 | + $log = $this->pipeline->getLogger(); |
|
39 | + if ($log->exists()) { |
|
40 | + $content = $log->content(); |
|
41 | + } else { |
|
42 | + $content = 'Waiting for action to start'; |
|
43 | + } |
|
44 | 44 | |
45 | - $sendJSON = (strpos($this->request->getHeader('Accept'), 'application/json') !== false) |
|
46 | - || $this->request->getExtension() == 'json'; |
|
45 | + $sendJSON = (strpos($this->request->getHeader('Accept'), 'application/json') !== false) |
|
46 | + || $this->request->getExtension() == 'json'; |
|
47 | 47 | |
48 | - $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content); |
|
49 | - if ($sendJSON) { |
|
50 | - $this->response->addHeader("Content-type", "application/json"); |
|
51 | - return json_encode(array( |
|
52 | - 'status' => $this->pipeline->Status, |
|
53 | - 'content' => $content, |
|
54 | - )); |
|
55 | - } else { |
|
56 | - $this->response->addHeader("Content-type", "text/plain"); |
|
57 | - return $content; |
|
58 | - } |
|
59 | - } |
|
48 | + $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content); |
|
49 | + if ($sendJSON) { |
|
50 | + $this->response->addHeader("Content-type", "application/json"); |
|
51 | + return json_encode(array( |
|
52 | + 'status' => $this->pipeline->Status, |
|
53 | + 'content' => $content, |
|
54 | + )); |
|
55 | + } else { |
|
56 | + $this->response->addHeader("Content-type", "text/plain"); |
|
57 | + return $content; |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Aborts the current pipeline |
|
63 | - */ |
|
64 | - public function abort() |
|
65 | - { |
|
66 | - if ($this->pipeline->canAbort()) { |
|
67 | - $this->pipeline->markAborted(); |
|
68 | - } |
|
69 | - return $this->redirect($this->pipeline->Environment()->Link()); |
|
70 | - } |
|
61 | + /** |
|
62 | + * Aborts the current pipeline |
|
63 | + */ |
|
64 | + public function abort() |
|
65 | + { |
|
66 | + if ($this->pipeline->canAbort()) { |
|
67 | + $this->pipeline->markAborted(); |
|
68 | + } |
|
69 | + return $this->redirect($this->pipeline->Environment()->Link()); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Perform an action on the current pipeline step |
|
74 | - */ |
|
75 | - public function step() |
|
76 | - { |
|
77 | - $action = $this->request->param('ID'); |
|
78 | - $step = $this->pipeline->CurrentStep(); |
|
72 | + /** |
|
73 | + * Perform an action on the current pipeline step |
|
74 | + */ |
|
75 | + public function step() |
|
76 | + { |
|
77 | + $action = $this->request->param('ID'); |
|
78 | + $step = $this->pipeline->CurrentStep(); |
|
79 | 79 | |
80 | - // Check if the action is available on this step |
|
81 | - if ($step && ($actions = $step->allowedActions()) && isset($actions[$action])) { |
|
82 | - // Execute this action, allowing it to override the httpresponse given |
|
83 | - $step->$action(); |
|
84 | - } |
|
85 | - return $this->redirect($this->pipeline->Environment()->Link()); |
|
86 | - } |
|
80 | + // Check if the action is available on this step |
|
81 | + if ($step && ($actions = $step->allowedActions()) && isset($actions[$action])) { |
|
82 | + // Execute this action, allowing it to override the httpresponse given |
|
83 | + $step->$action(); |
|
84 | + } |
|
85 | + return $this->redirect($this->pipeline->Environment()->Link()); |
|
86 | + } |
|
87 | 87 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function log() |
37 | 37 | { |
38 | 38 | $log = $this->pipeline->getLogger(); |
39 | - if ($log->exists()) { |
|
39 | + if($log->exists()) { |
|
40 | 40 | $content = $log->content(); |
41 | 41 | } else { |
42 | 42 | $content = 'Waiting for action to start'; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | || $this->request->getExtension() == 'json'; |
47 | 47 | |
48 | 48 | $content = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n", $content); |
49 | - if ($sendJSON) { |
|
49 | + if($sendJSON) { |
|
50 | 50 | $this->response->addHeader("Content-type", "application/json"); |
51 | 51 | return json_encode(array( |
52 | 52 | 'status' => $this->pipeline->Status, |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function abort() |
65 | 65 | { |
66 | - if ($this->pipeline->canAbort()) { |
|
66 | + if($this->pipeline->canAbort()) { |
|
67 | 67 | $this->pipeline->markAborted(); |
68 | 68 | } |
69 | 69 | return $this->redirect($this->pipeline->Environment()->Link()); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $step = $this->pipeline->CurrentStep(); |
79 | 79 | |
80 | 80 | // Check if the action is available on this step |
81 | - if ($step && ($actions = $step->allowedActions()) && isset($actions[$action])) { |
|
81 | + if($step && ($actions = $step->allowedActions()) && isset($actions[$action])) { |
|
82 | 82 | // Execute this action, allowing it to override the httpresponse given |
83 | 83 | $step->$action(); |
84 | 84 | } |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class PipelineController extends Controller |
|
4 | -{ |
|
3 | +class PipelineController extends Controller { |
|
5 | 4 | |
6 | 5 | private static $allowed_actions = array( |
7 | 6 | 'abort', |
@@ -13,8 +12,7 @@ discard block |
||
13 | 12 | |
14 | 13 | protected $pipeline = null; |
15 | 14 | |
16 | - public function __construct($controller, Pipeline $pipeline) |
|
17 | - { |
|
15 | + public function __construct($controller, Pipeline $pipeline) { |
|
18 | 16 | $this->controller = $controller; |
19 | 17 | parent::__construct(); |
20 | 18 | $this->pipeline = $pipeline; |
@@ -23,8 +21,7 @@ discard block |
||
23 | 21 | /** |
24 | 22 | * Shows status of this pipeline |
25 | 23 | */ |
26 | - public function index() |
|
27 | - { |
|
24 | + public function index() { |
|
28 | 25 | return $this->controller->customise(new ArrayData(array( |
29 | 26 | 'Pipeline' => $this->pipeline |
30 | 27 | )))->renderWith('DNRoot_pipeline'); |
@@ -33,8 +30,7 @@ discard block |
||
33 | 30 | /** |
34 | 31 | * Get log for this pipeline |
35 | 32 | */ |
36 | - public function log() |
|
37 | - { |
|
33 | + public function log() { |
|
38 | 34 | $log = $this->pipeline->getLogger(); |
39 | 35 | if ($log->exists()) { |
40 | 36 | $content = $log->content(); |
@@ -61,8 +57,7 @@ discard block |
||
61 | 57 | /** |
62 | 58 | * Aborts the current pipeline |
63 | 59 | */ |
64 | - public function abort() |
|
65 | - { |
|
60 | + public function abort() { |
|
66 | 61 | if ($this->pipeline->canAbort()) { |
67 | 62 | $this->pipeline->markAborted(); |
68 | 63 | } |
@@ -72,8 +67,7 @@ discard block |
||
72 | 67 | /** |
73 | 68 | * Perform an action on the current pipeline step |
74 | 69 | */ |
75 | - public function step() |
|
76 | - { |
|
70 | + public function step() { |
|
77 | 71 | $action = $this->request->param('ID'); |
78 | 72 | $step = $this->pipeline->CurrentStep(); |
79 | 73 |
@@ -3,29 +3,29 @@ |
||
3 | 3 | class GitSHA extends Varchar |
4 | 4 | { |
5 | 5 | |
6 | - /** |
|
7 | - * @param string|null $name |
|
8 | - * @param array $options |
|
9 | - */ |
|
10 | - public function __construct($name = null, $options = array()) |
|
11 | - { |
|
12 | - // Size should probably be 40, but to avoid schema change leave for now |
|
13 | - parent::__construct($name, 255, $options); |
|
14 | - } |
|
6 | + /** |
|
7 | + * @param string|null $name |
|
8 | + * @param array $options |
|
9 | + */ |
|
10 | + public function __construct($name = null, $options = array()) |
|
11 | + { |
|
12 | + // Size should probably be 40, but to avoid schema change leave for now |
|
13 | + parent::__construct($name, 255, $options); |
|
14 | + } |
|
15 | 15 | |
16 | - /** |
|
17 | - * @return string |
|
18 | - */ |
|
19 | - public function FullHash() |
|
20 | - { |
|
21 | - return $this->value; |
|
22 | - } |
|
16 | + /** |
|
17 | + * @return string |
|
18 | + */ |
|
19 | + public function FullHash() |
|
20 | + { |
|
21 | + return $this->value; |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function ShortHash() |
|
28 | - { |
|
29 | - return substr($this->value, 0, 7); |
|
30 | - } |
|
24 | + /** |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function ShortHash() |
|
28 | + { |
|
29 | + return substr($this->value, 0, 7); |
|
30 | + } |
|
31 | 31 | } |
@@ -1,14 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class GitSHA extends Varchar |
|
4 | -{ |
|
3 | +class GitSHA extends Varchar { |
|
5 | 4 | |
6 | 5 | /** |
7 | 6 | * @param string|null $name |
8 | 7 | * @param array $options |
9 | 8 | */ |
10 | - public function __construct($name = null, $options = array()) |
|
11 | - { |
|
9 | + public function __construct($name = null, $options = array()) { |
|
12 | 10 | // Size should probably be 40, but to avoid schema change leave for now |
13 | 11 | parent::__construct($name, 255, $options); |
14 | 12 | } |
@@ -16,16 +14,14 @@ discard block |
||
16 | 14 | /** |
17 | 15 | * @return string |
18 | 16 | */ |
19 | - public function FullHash() |
|
20 | - { |
|
17 | + public function FullHash() { |
|
21 | 18 | return $this->value; |
22 | 19 | } |
23 | 20 | |
24 | 21 | /** |
25 | 22 | * @return string |
26 | 23 | */ |
27 | - public function ShortHash() |
|
28 | - { |
|
24 | + public function ShortHash() { |
|
29 | 25 | return substr($this->value, 0, 7); |
30 | 26 | } |
31 | 27 | } |
@@ -3,29 +3,29 @@ |
||
3 | 3 | interface DeploynautEventInterface extends \League\Event\EventInterface |
4 | 4 | { |
5 | 5 | |
6 | - /** |
|
7 | - * Should return the event name, e.g 'event.name' |
|
8 | - * |
|
9 | - * @return string |
|
10 | - */ |
|
11 | - public function getName(); |
|
6 | + /** |
|
7 | + * Should return the event name, e.g 'event.name' |
|
8 | + * |
|
9 | + * @return string |
|
10 | + */ |
|
11 | + public function getName(); |
|
12 | 12 | |
13 | - /** |
|
14 | - * Get the value for the $keyname or empty string |
|
15 | - * |
|
16 | - * @param string $keyname |
|
17 | - * |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public function get($keyname); |
|
13 | + /** |
|
14 | + * Get the value for the $keyname or empty string |
|
15 | + * |
|
16 | + * @param string $keyname |
|
17 | + * |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public function get($keyname); |
|
21 | 21 | |
22 | - /** |
|
23 | - * @return array |
|
24 | - */ |
|
25 | - public function asArray(); |
|
22 | + /** |
|
23 | + * @return array |
|
24 | + */ |
|
25 | + public function asArray(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * @return string - returns the data as json |
|
29 | - */ |
|
30 | - public function asJSON(); |
|
27 | + /** |
|
28 | + * @return string - returns the data as json |
|
29 | + */ |
|
30 | + public function asJSON(); |
|
31 | 31 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -interface DeploynautEventInterface extends \League\Event\EventInterface |
|
4 | -{ |
|
3 | +interface DeploynautEventInterface extends \League\Event\EventInterface { |
|
5 | 4 | |
6 | 5 | /** |
7 | 6 | * Should return the event name, e.g 'event.name' |
@@ -23,83 +23,83 @@ |
||
23 | 23 | class GenericEvent extends AbstractEvent implements DeploynautEventInterface |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $name = ''; |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $name = ''; |
|
30 | 30 | |
31 | - /** |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - protected $data = []; |
|
31 | + /** |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + protected $data = []; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param string $name - event name |
|
38 | - * @param array $data |
|
39 | - * |
|
40 | - * @return GenericEvent |
|
41 | - */ |
|
42 | - public static function create($name, array $data) |
|
43 | - { |
|
44 | - return Injector::inst()->createWithArgs(get_called_class(), [$name, $data]); |
|
45 | - } |
|
36 | + /** |
|
37 | + * @param string $name - event name |
|
38 | + * @param array $data |
|
39 | + * |
|
40 | + * @return GenericEvent |
|
41 | + */ |
|
42 | + public static function create($name, array $data) |
|
43 | + { |
|
44 | + return Injector::inst()->createWithArgs(get_called_class(), [$name, $data]); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Event constructor |
|
49 | - * |
|
50 | - * @param string $eventName - e.g. 'event.name' |
|
51 | - * @param array $data |
|
52 | - */ |
|
53 | - public function __construct($eventName, array $data) |
|
54 | - { |
|
55 | - $this->name = $eventName; |
|
56 | - $this->data = $data; |
|
57 | - } |
|
47 | + /** |
|
48 | + * Event constructor |
|
49 | + * |
|
50 | + * @param string $eventName - e.g. 'event.name' |
|
51 | + * @param array $data |
|
52 | + */ |
|
53 | + public function __construct($eventName, array $data) |
|
54 | + { |
|
55 | + $this->name = $eventName; |
|
56 | + $this->data = $data; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * get the event name, e.g 'event.name' |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - public function getName() |
|
65 | - { |
|
66 | - return $this->name; |
|
67 | - } |
|
59 | + /** |
|
60 | + * get the event name, e.g 'event.name' |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + public function getName() |
|
65 | + { |
|
66 | + return $this->name; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Get the value for the $keyname or empty string |
|
71 | - * |
|
72 | - * @param string $keyname |
|
73 | - * |
|
74 | - * @return string |
|
75 | - */ |
|
76 | - public function get($keyname) |
|
77 | - { |
|
78 | - if (array_key_exists($keyname, $this->data)) { |
|
79 | - return $this->data[$keyname]; |
|
80 | - } |
|
81 | - return ''; |
|
82 | - } |
|
69 | + /** |
|
70 | + * Get the value for the $keyname or empty string |
|
71 | + * |
|
72 | + * @param string $keyname |
|
73 | + * |
|
74 | + * @return string |
|
75 | + */ |
|
76 | + public function get($keyname) |
|
77 | + { |
|
78 | + if (array_key_exists($keyname, $this->data)) { |
|
79 | + return $this->data[$keyname]; |
|
80 | + } |
|
81 | + return ''; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * return all the data as an array, including the event name as 'event'; |
|
86 | - * |
|
87 | - * @return array |
|
88 | - */ |
|
89 | - public function asArray() |
|
90 | - { |
|
91 | - $payload = $this->data; |
|
92 | - $payload['event'] = $this->getName(); |
|
93 | - return $payload; |
|
94 | - } |
|
84 | + /** |
|
85 | + * return all the data as an array, including the event name as 'event'; |
|
86 | + * |
|
87 | + * @return array |
|
88 | + */ |
|
89 | + public function asArray() |
|
90 | + { |
|
91 | + $payload = $this->data; |
|
92 | + $payload['event'] = $this->getName(); |
|
93 | + return $payload; |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * return all the data as a JSON string, including the event name as 'event'; |
|
98 | - * |
|
99 | - * @return string - returns the data as json |
|
100 | - */ |
|
101 | - public function asJSON() |
|
102 | - { |
|
103 | - return json_encode($this->asArray()); |
|
104 | - } |
|
96 | + /** |
|
97 | + * return all the data as a JSON string, including the event name as 'event'; |
|
98 | + * |
|
99 | + * @return string - returns the data as json |
|
100 | + */ |
|
101 | + public function asJSON() |
|
102 | + { |
|
103 | + return json_encode($this->asArray()); |
|
104 | + } |
|
105 | 105 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | */ |
76 | 76 | public function get($keyname) |
77 | 77 | { |
78 | - if (array_key_exists($keyname, $this->data)) { |
|
78 | + if(array_key_exists($keyname, $this->data)) { |
|
79 | 79 | return $this->data[$keyname]; |
80 | 80 | } |
81 | 81 | return ''; |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * See more on how to use the event system here: http://event.thephpleague.com/2.0/ |
22 | 22 | */ |
23 | -class GenericEvent extends AbstractEvent implements DeploynautEventInterface |
|
24 | -{ |
|
23 | +class GenericEvent extends AbstractEvent implements DeploynautEventInterface { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * @var string |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | * |
40 | 39 | * @return GenericEvent |
41 | 40 | */ |
42 | - public static function create($name, array $data) |
|
43 | - { |
|
41 | + public static function create($name, array $data) { |
|
44 | 42 | return Injector::inst()->createWithArgs(get_called_class(), [$name, $data]); |
45 | 43 | } |
46 | 44 | |
@@ -50,8 +48,7 @@ discard block |
||
50 | 48 | * @param string $eventName - e.g. 'event.name' |
51 | 49 | * @param array $data |
52 | 50 | */ |
53 | - public function __construct($eventName, array $data) |
|
54 | - { |
|
51 | + public function __construct($eventName, array $data) { |
|
55 | 52 | $this->name = $eventName; |
56 | 53 | $this->data = $data; |
57 | 54 | } |
@@ -61,8 +58,7 @@ discard block |
||
61 | 58 | * |
62 | 59 | * @return string |
63 | 60 | */ |
64 | - public function getName() |
|
65 | - { |
|
61 | + public function getName() { |
|
66 | 62 | return $this->name; |
67 | 63 | } |
68 | 64 | |
@@ -73,8 +69,7 @@ discard block |
||
73 | 69 | * |
74 | 70 | * @return string |
75 | 71 | */ |
76 | - public function get($keyname) |
|
77 | - { |
|
72 | + public function get($keyname) { |
|
78 | 73 | if (array_key_exists($keyname, $this->data)) { |
79 | 74 | return $this->data[$keyname]; |
80 | 75 | } |
@@ -86,8 +81,7 @@ discard block |
||
86 | 81 | * |
87 | 82 | * @return array |
88 | 83 | */ |
89 | - public function asArray() |
|
90 | - { |
|
84 | + public function asArray() { |
|
91 | 85 | $payload = $this->data; |
92 | 86 | $payload['event'] = $this->getName(); |
93 | 87 | return $payload; |
@@ -98,8 +92,7 @@ discard block |
||
98 | 92 | * |
99 | 93 | * @return string - returns the data as json |
100 | 94 | */ |
101 | - public function asJSON() |
|
102 | - { |
|
95 | + public function asJSON() { |
|
103 | 96 | return json_encode($this->asArray()); |
104 | 97 | } |
105 | 98 | } |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | class DeploynautFileExtension extends DataExtension |
3 | 3 | { |
4 | - /** |
|
5 | - * If this file is attached to a {@link DNDataArchive}, then we need to check security permissions, to ensure the |
|
6 | - * currently logged in {@link Member} can download the file. |
|
7 | - * |
|
8 | - * This uses the secureassets module to provide the security of these assets. |
|
9 | - */ |
|
10 | - public function canDownload() |
|
11 | - { |
|
12 | - $member = Member::currentUser(); |
|
13 | - $file = $this->owner; |
|
14 | - $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First(); |
|
4 | + /** |
|
5 | + * If this file is attached to a {@link DNDataArchive}, then we need to check security permissions, to ensure the |
|
6 | + * currently logged in {@link Member} can download the file. |
|
7 | + * |
|
8 | + * This uses the secureassets module to provide the security of these assets. |
|
9 | + */ |
|
10 | + public function canDownload() |
|
11 | + { |
|
12 | + $member = Member::currentUser(); |
|
13 | + $file = $this->owner; |
|
14 | + $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First(); |
|
15 | 15 | |
16 | - if ($archive) { |
|
17 | - return $archive->canDownload($member); |
|
18 | - } |
|
16 | + if ($archive) { |
|
17 | + return $archive->canDownload($member); |
|
18 | + } |
|
19 | 19 | |
20 | - return true; // By default, files can be downloaded from assets/ normally |
|
21 | - } |
|
20 | + return true; // By default, files can be downloaded from assets/ normally |
|
21 | + } |
|
22 | 22 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $file = $this->owner; |
14 | 14 | $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First(); |
15 | 15 | |
16 | - if ($archive) { |
|
16 | + if($archive) { |
|
17 | 17 | return $archive->canDownload($member); |
18 | 18 | } |
19 | 19 |
@@ -1,14 +1,12 @@ |
||
1 | 1 | <?php |
2 | -class DeploynautFileExtension extends DataExtension |
|
3 | -{ |
|
2 | +class DeploynautFileExtension extends DataExtension { |
|
4 | 3 | /** |
5 | 4 | * If this file is attached to a {@link DNDataArchive}, then we need to check security permissions, to ensure the |
6 | 5 | * currently logged in {@link Member} can download the file. |
7 | 6 | * |
8 | 7 | * This uses the secureassets module to provide the security of these assets. |
9 | 8 | */ |
10 | - public function canDownload() |
|
11 | - { |
|
9 | + public function canDownload() { |
|
12 | 10 | $member = Member::currentUser(); |
13 | 11 | $file = $this->owner; |
14 | 12 | $archive = DNDataArchive::get()->filter('ArchiveFileID', $file->ID)->First(); |
@@ -3,13 +3,13 @@ |
||
3 | 3 | class DeploynautSecurityExtension extends Extension |
4 | 4 | { |
5 | 5 | |
6 | - public function onAfterInit() |
|
7 | - { |
|
8 | - // the 'ping' action is called via AJAX from the /admin and will cause |
|
9 | - // the admin section to 'grow' over time. We only need the css and js |
|
10 | - // for login, reset, logout and so on. |
|
11 | - if (!$this->owner->getRequest()->isAjax()) { |
|
12 | - DNRoot::include_requirements(); |
|
13 | - } |
|
14 | - } |
|
6 | + public function onAfterInit() |
|
7 | + { |
|
8 | + // the 'ping' action is called via AJAX from the /admin and will cause |
|
9 | + // the admin section to 'grow' over time. We only need the css and js |
|
10 | + // for login, reset, logout and so on. |
|
11 | + if (!$this->owner->getRequest()->isAjax()) { |
|
12 | + DNRoot::include_requirements(); |
|
13 | + } |
|
14 | + } |
|
15 | 15 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // the 'ping' action is called via AJAX from the /admin and will cause |
9 | 9 | // the admin section to 'grow' over time. We only need the css and js |
10 | 10 | // for login, reset, logout and so on. |
11 | - if (!$this->owner->getRequest()->isAjax()) { |
|
11 | + if(!$this->owner->getRequest()->isAjax()) { |
|
12 | 12 | DNRoot::include_requirements(); |
13 | 13 | } |
14 | 14 | } |
@@ -1,10 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class DeploynautSecurityExtension extends Extension |
|
4 | -{ |
|
3 | +class DeploynautSecurityExtension extends Extension { |
|
5 | 4 | |
6 | - public function onAfterInit() |
|
7 | - { |
|
5 | + public function onAfterInit() { |
|
8 | 6 | // the 'ping' action is called via AJAX from the /admin and will cause |
9 | 7 | // the admin section to 'grow' over time. We only need the css and js |
10 | 8 | // for login, reset, logout and so on. |
@@ -3,15 +3,15 @@ |
||
3 | 3 | class FrontendLink extends DataExtension |
4 | 4 | { |
5 | 5 | |
6 | - public function updateItemEditForm($form) |
|
7 | - { |
|
8 | - if ($this->owner->record->hasMethod('Link')) { |
|
9 | - $link = sprintf( |
|
10 | - '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview »</a>', |
|
11 | - $this->owner->record->Link() |
|
12 | - ); |
|
13 | - $actions = $form->Actions(); |
|
14 | - $actions->push(LiteralField::create('FrontendLink', $link)); |
|
15 | - } |
|
16 | - } |
|
6 | + public function updateItemEditForm($form) |
|
7 | + { |
|
8 | + if ($this->owner->record->hasMethod('Link')) { |
|
9 | + $link = sprintf( |
|
10 | + '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview »</a>', |
|
11 | + $this->owner->record->Link() |
|
12 | + ); |
|
13 | + $actions = $form->Actions(); |
|
14 | + $actions->push(LiteralField::create('FrontendLink', $link)); |
|
15 | + } |
|
16 | + } |
|
17 | 17 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | public function updateItemEditForm($form) |
7 | 7 | { |
8 | - if ($this->owner->record->hasMethod('Link')) { |
|
8 | + if($this->owner->record->hasMethod('Link')) { |
|
9 | 9 | $link = sprintf( |
10 | 10 | '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview »</a>', |
11 | 11 | $this->owner->record->Link() |
@@ -1,10 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrontendLink extends DataExtension |
|
4 | -{ |
|
3 | +class FrontendLink extends DataExtension { |
|
5 | 4 | |
6 | - public function updateItemEditForm($form) |
|
7 | - { |
|
5 | + public function updateItemEditForm($form) { |
|
8 | 6 | if ($this->owner->record->hasMethod('Link')) { |
9 | 7 | $link = sprintf( |
10 | 8 | '<a style="margin: 0.5em" target="deploynaut-frontend" href="%s">Preview »</a>', |
@@ -3,10 +3,10 @@ |
||
3 | 3 | class ProjectMemberExtension extends DataExtension |
4 | 4 | { |
5 | 5 | |
6 | - /** |
|
7 | - * @var array |
|
8 | - */ |
|
9 | - private static $belongs_many_many = array( |
|
10 | - 'StarredProjects' => 'DNProject' |
|
11 | - ); |
|
6 | + /** |
|
7 | + * @var array |
|
8 | + */ |
|
9 | + private static $belongs_many_many = array( |
|
10 | + 'StarredProjects' => 'DNProject' |
|
11 | + ); |
|
12 | 12 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class ProjectMemberExtension extends DataExtension |
|
4 | -{ |
|
3 | +class ProjectMemberExtension extends DataExtension { |
|
5 | 4 | |
6 | 5 | /** |
7 | 6 | * @var array |