aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2016-11-25 11:08:44 +0100
committerGitHub <noreply@github.com>2016-11-25 11:08:44 +0100
commite7a4aeca6f2af9056f0d3a579a5e4f927b321b8c (patch)
treeb38cb4de2445c2e8b8661eafe62760d22a8983e7
parent08a4bbb7d0b9c63ec97bb4f74e5842cc3ea8ee77 (diff)
parent86002a2f7b51b08880629166c9836b18f7eecf98 (diff)
downloadvolse-hubzilla-e7a4aeca6f2af9056f0d3a579a5e4f927b321b8c.tar.gz
volse-hubzilla-e7a4aeca6f2af9056f0d3a579a5e4f927b321b8c.tar.bz2
volse-hubzilla-e7a4aeca6f2af9056f0d3a579a5e4f927b321b8c.zip
Merge pull request #601 from anaqreon/wiki
Wiki: Make a git commit when a new page is created
-rw-r--r--Zotlabs/Module/Wiki.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 0c848bc7c..8069afc7c 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -382,7 +382,18 @@ class Wiki extends \Zotlabs\Web\Controller {
}
$page = wiki_create_page($name, $resource_id);
if ($page['success']) {
- json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']), 'success' => true));
+ $ob = \App::get_observer();
+ $commit = wiki_git_commit(array(
+ 'commit_msg' => t('New page created'),
+ 'resource_id' => $resource_id,
+ 'observer' => $ob,
+ 'files' => array($page['page']['urlName'].'.md')
+ ));
+ if($commit['success']) {
+ json_return_and_die(array('url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']), 'success' => true));
+ } else {
+ json_return_and_die(array('message' => 'Error making git commit','url' => '/'.argv(0).'/'.argv(1).'/'.$page['wiki']['urlName'].'/'.urlencode($page['page']['urlName']),'success' => false));
+ }
} else {
logger('Error creating page');
json_return_and_die(array('message' => 'Error creating page.', 'success' => false));