aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/NativeWiki.php10
-rw-r--r--Zotlabs/Module/Wiki.php12
2 files changed, 13 insertions, 9 deletions
diff --git a/Zotlabs/Lib/NativeWiki.php b/Zotlabs/Lib/NativeWiki.php
index f4089d8a2..3dc914772 100644
--- a/Zotlabs/Lib/NativeWiki.php
+++ b/Zotlabs/Lib/NativeWiki.php
@@ -100,10 +100,14 @@ class NativeWiki {
}
}
- static public function sync_a_wiki_item($uid,$id) {
- $r = q("select * from item where id = %d and uid = %d",
+ static public function sync_a_wiki_item($uid,$id,$resource_id) {
+
+
+ $r = q("SELECT * from item WHERE uid = %d AND ( id = %d OR ( resource_type = '%s and resource_id = %d )) ",
+ intval($uid),
intval($id),
- intval($uid)
+ dbesc(NWIKI_ITEM_RESOURCE_TYPE)
+ intval($resource_id)
);
if($r) {
xchan_query($r);
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 2ab7379c4..222c10155 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -361,7 +361,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$acl->set_from_array($_POST);
$r = Zlib\NativeWiki::create_wiki($owner, $observer_hash, $wiki, $acl);
if($r['success']) {
- Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$r['item_id']);
+ Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$r['item_id'],$r['item']['resource_id']);
$homePage = Zlib\NativeWikiPage::create_page($owner['channel_id'],$observer_hash,'Home', $r['item']['resource_id']);
if(! $homePage['success']) {
notice( t('Wiki created, but error creating Home page.'));
@@ -387,7 +387,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$resource_id = $_POST['resource_id'];
$deleted = Zlib\NativeWiki::delete_wiki($owner['channel_id'],$observer_hash,$resource_id);
if ($deleted['success']) {
- Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$deleted['item_id']);
+ Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$deleted['item_id'],$resource_id);
json_return_and_die(array('message' => '', 'success' => true));
}
else {
@@ -427,7 +427,7 @@ class Wiki extends \Zotlabs\Web\Controller {
));
if($commit['success']) {
- Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id']);
+ Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
json_return_and_die(array('url' => '/' . argv(0) . '/' . argv(1) . '/' . $page['wiki']['urlName'] . '/' . $page['page']['urlName'], 'success' => true));
}
else {
@@ -492,7 +492,7 @@ class Wiki extends \Zotlabs\Web\Controller {
));
if($commit['success']) {
- Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id']);
+ Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
}
else {
@@ -555,7 +555,7 @@ class Wiki extends \Zotlabs\Web\Controller {
'files' => null
));
if($commit['success']) {
- Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id']);
+ Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
json_return_and_die(array('message' => 'Wiki git repo commit made', 'success' => true));
}
else {
@@ -643,7 +643,7 @@ class Wiki extends \Zotlabs\Web\Controller {
));
if($commit['success']) {
- Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id']);
+ Zlib\NativeWiki::sync_a_wiki_item($owner['channel_id'],$commit['item_id'],$resource_id);
json_return_and_die(array('name' => $renamed['page'], 'message' => 'Wiki git repo commit made', 'success' => true));
}
else {