aboutsummaryrefslogtreecommitdiffstats
path: root/include/wiki.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-06-04 18:00:32 -0400
committerAndrew Manning <tamanning@zoho.com>2016-06-04 18:00:32 -0400
commit4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8 (patch)
treea083e9b77bf662a049aa94599c0ab83f6e5b0453 /include/wiki.php
parenta92241d3cf609b60cb9dbaa0ef5a7ff7237e7faa (diff)
downloadvolse-hubzilla-4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8.tar.gz
volse-hubzilla-4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8.tar.bz2
volse-hubzilla-4bc4fd5b7ebd7c5f25cfc9acfbda5b14a38dedb8.zip
Page deletion implemented. Hide the delete button and disallow for Home page.
Diffstat (limited to 'include/wiki.php')
-rw-r--r--include/wiki.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/wiki.php b/include/wiki.php
index ccf47ef9a..1f90fae1e 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -289,6 +289,24 @@ function wiki_save_page($arr) {
}
}
+function wiki_delete_page($arr) {
+ $pageUrlName = ((array_key_exists('pageUrlName',$arr)) ? $arr['pageUrlName'] : '');
+ $resource_id = ((array_key_exists('resource_id',$arr)) ? $arr['resource_id'] : '');
+ $w = wiki_get_wiki($resource_id);
+ if (!$w['path']) {
+ return array('message' => 'Error reading wiki', 'success' => false);
+ }
+ $page_path = $w['path'].'/'.$pageUrlName.'.md';
+ if (is_writable($page_path) === true) {
+ if(!unlink($page_path)) {
+ return array('message' => 'Error deleting page file', 'success' => false);
+ }
+ return array('message' => '', 'success' => true);
+ } else {
+ return array('message' => 'Page file not writable', 'success' => false);
+ }
+}
+
function wiki_git_commit($arr) {
$files = ((array_key_exists('files', $arr)) ? $arr['files'] : null);
$commit_msg = ((array_key_exists('commit_msg', $arr)) ? $arr['commit_msg'] : 'Repo updated');