diff options
author | Andrew Manning <andrew@reticu.li> | 2016-11-24 18:24:15 -0500 |
---|---|---|
committer | Andrew Manning <andrew@reticu.li> | 2016-11-24 18:24:15 -0500 |
commit | 86002a2f7b51b08880629166c9836b18f7eecf98 (patch) | |
tree | 2dc6e41a6b3b8c3970bf5d7243f52da88425d430 /Zotlabs/Module/Wiki.php | |
parent | 1596391a2ebcdfe9955e28b1db14adc05a6856da (diff) | |
download | volse-hubzilla-86002a2f7b51b08880629166c9836b18f7eecf98.tar.gz volse-hubzilla-86002a2f7b51b08880629166c9836b18f7eecf98.tar.bz2 volse-hubzilla-86002a2f7b51b08880629166c9836b18f7eecf98.zip |
Make a git commit when a new page is created, recording who created the page.
Diffstat (limited to 'Zotlabs/Module/Wiki.php')
-rw-r--r-- | Zotlabs/Module/Wiki.php | 13 |
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)); |