diff options
author | Hubzilla <hubzilla@hz.macgirvin.com> | 2017-01-22 18:48:45 -0800 |
---|---|---|
committer | Hubzilla <hubzilla@hz.macgirvin.com> | 2017-01-22 18:48:45 -0800 |
commit | 17f1d39fcf973ac35f14a36faa2b92867fbb11e9 (patch) | |
tree | 43ba2ffbfbeb0b056625aabc4aeb42707747d693 /Zotlabs/Lib/NativeWikiPage.php | |
parent | 3bafa05ad1093d70c893d0985788203ccb1e7169 (diff) | |
download | volse-hubzilla-17f1d39fcf973ac35f14a36faa2b92867fbb11e9.tar.gz volse-hubzilla-17f1d39fcf973ac35f14a36faa2b92867fbb11e9.tar.bz2 volse-hubzilla-17f1d39fcf973ac35f14a36faa2b92867fbb11e9.zip |
basic support for clone syncing of wikis and wiki pages
Diffstat (limited to 'Zotlabs/Lib/NativeWikiPage.php')
-rw-r--r-- | Zotlabs/Lib/NativeWikiPage.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php index 0c3698519..f0b8b76a1 100644 --- a/Zotlabs/Lib/NativeWikiPage.php +++ b/Zotlabs/Lib/NativeWikiPage.php @@ -61,16 +61,19 @@ class NativeWikiPage { set_iconfig($arr,'nwikipage','pagetitle',urlencode(($name) ? $name : t('(No Title)')),true); - post_activity_item($arr, false, false); + $p = post_activity_item($arr, false, false); - $page = [ - 'rawName' => $name, - 'htmlName' => escape_tags($name), - 'urlName' => urlencode(escape_tags($name)), - 'fileName' => urlencode(escape_tags($name)) . Zlib\NativeWikiPage::get_file_ext($w) - ]; + if($p['success']) { + $page = [ + 'rawName' => $name, + 'htmlName' => escape_tags($name), + 'urlName' => urlencode(escape_tags($name)), + 'fileName' => urlencode(escape_tags($name)) . Zlib\NativeWikiPage::get_file_ext($w) + ]; - return array('page' => $page, 'wiki' => $w, 'message' => '', 'success' => true); + return array('page' => $page, 'item_id' => $p['post_id'], 'wiki' => $w, 'message' => '', 'success' => true); + } + return [ 'success' => false, 'message' => t('Wiki page create failed.') ]; } static public function rename_page($arr) { @@ -119,7 +122,7 @@ class NativeWikiPage { return [ 'success' => true, 'page' => $page ]; } - return [ 'success' => false, 'message' => t('Page not found') ]; + return [ 'success' => false, 'item_id' => $c['item_id'], 'message' => t('Page not found') ]; } @@ -358,7 +361,7 @@ class NativeWikiPage { $ret = item_store($item, false, false); if($ret['item_id']) - return array('message' => '', 'filename' => $filename, 'success' => true); + return array('message' => '', 'item_id' => $ret['item_id'], 'filename' => $filename, 'success' => true); else return array('message' => t('Page update failed.'), 'success' => false); } @@ -490,7 +493,7 @@ class NativeWikiPage { if($page) { set_iconfig($page['id'],'nwikipage','commit_msg',escape_tags($commit_msg),true); - return [ 'success' => true, 'page' => $page ]; + return [ 'success' => true, 'item_id' => $page['id'], 'page' => $page ]; } return [ 'success' => false, 'message' => t('Page not found.') ]; |