Skip to content

Commit

Permalink
feat: add cron-hooks-enabled option
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbestle authored and Pascal Küsgen committed Jun 27, 2016
1 parent edd2a68 commit 2118b28
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
30 changes: 16 additions & 14 deletions git-commit-and-push-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@
$gitHelper->kirbyChange('delete(file): ' . $file->page()->uri() . '/' . $file->filename());
});

kirby()->routes(array(
array(
'pattern' => 'gcapc/(:any)',
'action' => function($gitCommand) use ($gitHelper) {
switch ($gitCommand) {
case "push":
$gitHelper->push();
break;
case "pull":
$gitHelper->pull();
break;
if(c::get('gcapc-cron-hooks-enabled', true)) {
kirby()->routes(array(
array(
'pattern' => 'gcapc/(:any)',
'action' => function($gitCommand) use ($gitHelper) {
switch ($gitCommand) {
case "push":
$gitHelper->push();
break;
case "pull":
$gitHelper->pull();
break;
}
}
}
)
));
)
));
}
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ Default value: `false`

Push your changes to remote?

#### gcapc-cron-hooks-enabled
Type: `Boolean`
Default value: `true`

Whether `yourdomain.com/gcapc/push` and `yourdomain.com/gcapc/pull` are enabled or not.

#### gcapc-gitBin
Type: `String`
Default value: `''`
Expand Down

0 comments on commit 2118b28

Please sign in to comment.