Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 866b314

Browse files
committed
ShareCenter : forward change event if node has a minisite on it, by forwarding to root node in shared repo.
1 parent dddf87c commit 866b314

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

core/src/plugins/action.share/src/ShareCenter.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
use Pydio\Core\Services\UsersService;
4949
use Pydio\Core\Services\ApplicationState;
5050
use Pydio\Core\Utils\Vars\InputFilter;
51+
use Pydio\Core\Utils\Vars\PathUtils;
5152
use Pydio\Core\Utils\Vars\XMLFilter;
5253
use Pydio\Core\PluginFramework\Plugin;
5354
use Pydio\Core\PluginFramework\PluginsService;
@@ -1225,10 +1226,17 @@ private function findMirrorNodesInShares($node, $direction){
12251226
continue;
12261227
}
12271228
$sharedNode = $metadata["SOURCE_NODE"];
1228-
$sharedPath = substr($node->getPath(), strlen($sharedNode->getPath()));
1229+
if($sharedNode === $node){
1230+
// This is a minisite on one file, using a content filter, send a node.change on root to force clear cache
1231+
$sharedPath = "/";
1232+
}else{
1233+
$sharedPath = substr($node->getPath(), strlen($sharedNode->getPath()));
1234+
}
12291235
$newContext = $crtContext->withRepositoryId($wsId);
12301236
$sharedNodeUrl = $newContext->getUrlBase().$sharedPath;
1231-
$result[$wsId] = array(new AJXP_Node($sharedNodeUrl), "DOWN");
1237+
$newNode = new AJXP_Node($sharedNodeUrl);
1238+
if($sharedPath === '/') $newNode->setLeaf(false);
1239+
$result[$wsId] = array($newNode, "DOWN");
12321240
$this->logDebug('MIRROR NODES', 'Found shared in parent - register node '.$sharedNodeUrl);
12331241
}
12341242
}

core/src/plugins/action.share/src/Store/ShareMetaManager.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ public function removeShareFromMeta($node, $shareId){
129129
*/
130130
public function collectSharesInParent($node, &$metas){
131131
$node->collectMetadataInParents(AJXP_SHARED_META_NAMESPACE, AJXP_METADATA_ALLUSERS, AJXP_METADATA_SCOPE_REPOSITORY, false, $metas);
132+
if($node->isLeaf()){
133+
$metadata = $node->retrieveMetadata(AJXP_SHARED_META_NAMESPACE, AJXP_METADATA_ALLUSERS, AJXP_METADATA_SCOPE_REPOSITORY,false);
134+
if($metadata != false){
135+
$metadata["SOURCE_NODE"] = $node;
136+
$metas[] = $metadata;
137+
}
138+
}
132139
}
133140

134141
/**

0 commit comments

Comments
 (0)