aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-24 06:15:42 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-24 06:15:42 -0400
commite00b8a70829213a4333a53a097c2c498d529f5d6 (patch)
tree74bd9a90a24671287106b85050480f9cc45fe79c /include
parenta36bef7979aecd72751d319f85b7037991979e35 (diff)
downloadvolse-hubzilla-e00b8a70829213a4333a53a097c2c498d529f5d6.tar.gz
volse-hubzilla-e00b8a70829213a4333a53a097c2c498d529f5d6.tar.bz2
volse-hubzilla-e00b8a70829213a4333a53a097c2c498d529f5d6.zip
Delete wiki (in progress)
Diffstat (limited to 'include')
-rw-r--r--include/wiki.php29
1 files changed, 20 insertions, 9 deletions
diff --git a/include/wiki.php b/include/wiki.php
index 7cd838f95..0f00cd122 100644
--- a/include/wiki.php
+++ b/include/wiki.php
@@ -7,14 +7,6 @@
use \Zotlabs\Storage\GitRepo as GitRepo;
define ( 'WIKI_ITEM_RESOURCE_TYPE', 'wiki' );
-function wiki_create() {
-
-}
-
-function wiki_delete() {
-
-}
-
function wiki_list($nick, $observer_hash) {
if (local_channel() || remote_channel()) {
$sql_extra = item_permissions_sql(get_channel_by_nick($nick)['channel_id'], $observer_hash);
@@ -36,7 +28,7 @@ function wiki_pages() {
function wiki_init_wiki($channel, $name) {
// Store the path as a relative path, but pass absolute path to mkdir
$path = 'store/[data]/git/'.$channel['channel_address'].'/wiki/'.$name;
- if (!mkdir(__DIR__ . '/../' . $path, 0770, true)) {
+ if (!os_mkdir(__DIR__ . '/../' . $path, 0770, true)) {
logger('Error creating wiki path: ' . $name);
return null;
}
@@ -109,3 +101,22 @@ function wiki_create_wiki($channel, $observer_hash, $name, $acl) {
return array('item' => null, 'success' => false);
}
}
+
+function wiki_delete_wiki($resource_id) {
+ $item = q("SELECT id FROM item WHERE resource_type = '%s' AND resource_id = '%s' AND item_deleted = 0 limit 1",
+ dbesc(WIKI_ITEM_RESOURCE_TYPE),
+ dbesc($resource_id)
+ );
+ if (!$item) {
+ return array('items' => null, 'success' => false);
+ } else {
+ $drop = drop_item($item[0]['id'],false,DROPITEM_NORMAL,true);
+ $object = json_decode($item[0]['object'], true);
+ $abs_path = __DIR__ . '/../' . $object['path'];
+ logger('path to delete: ' . $abs_path);
+ $pathdel = true;
+ //$pathdel = rrmdir($abs_path);
+
+ return array('item' => $item, 'success' => (($drop === 1 && $pathdel) ? true : false));
+ }
+}