本文整理汇总了PHP中AJXP_Node::setUser方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node::setUser方法的具体用法?PHP AJXP_Node::setUser怎么用?PHP AJXP_Node::setUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Node
的用法示例。
在下文中一共展示了AJXP_Node::setUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveSharesFromMetaRecursive
/**
* @param AJXP_Node $baseNode
* @param bool $delete
* @param string $oldPath
* @param string $newPath
* @param string|null $parentRepositoryPath
* @return int Number of nodes modified in different repositories
*/
public function moveSharesFromMetaRecursive($baseNode, $delete = false, $oldPath, $newPath, $parentRepositoryPath = null)
{
$modifiedDifferentNodes = 0;
// Find shares in children
try {
$result = $this->getMetaManager()->collectSharesIncludingChildren($baseNode);
} catch (Exception $e) {
// Error while loading node, ignore
return $modifiedDifferentNodes;
}
$basePath = $baseNode->getPath();
foreach ($result as $relativePath => $metadata) {
if ($relativePath == "/") {
$relativePath = "";
}
$modifiedDifferentNodes++;
$changeOldNode = new AJXP_Node("pydio://" . $baseNode->getRepositoryId() . $oldPath . $relativePath);
foreach ($metadata as $ownerId => $meta) {
if (!isset($meta["shares"])) {
continue;
}
$changeOldNode->setUser($ownerId);
/// do something
$changeNewNode = null;
if (!$delete) {
//$newPath = preg_replace('#^'.preg_quote($oldPath, '#').'#', $newPath, $path);
$changeNewNode = new AJXP_Node("pydio://" . $baseNode->getRepositoryId() . $newPath . $relativePath);
$changeNewNode->setUser($ownerId);
}
$collectedRepositories = array();
list($privateShares, $publicShares) = $this->moveSharesFromMeta($meta["shares"], $delete ? "delete" : "move", $changeOldNode, $changeNewNode, $collectedRepositories, $parentRepositoryPath);
if ($basePath == "/") {
// Just update target node!
$changeMetaNode = new AJXP_Node("pydio://" . $baseNode->getRepositoryId() . $relativePath);
$changeMetaNode->setUser($ownerId);
$this->getMetaManager()->clearNodeMeta($changeMetaNode);
if (count($privateShares)) {
$this->getMetaManager()->setNodeMeta($changeMetaNode, array("shares" => $privateShares), true);
}
if (count($publicShares)) {
$this->getMetaManager()->setNodeMeta($changeMetaNode, array("shares" => $privateShares), false);
}
} else {
$this->getMetaManager()->clearNodeMeta($changeOldNode);
if (!$delete) {
if (count($privateShares)) {
$this->getMetaManager()->setNodeMeta($changeNewNode, array("shares" => $privateShares), true);
}
if (count($publicShares)) {
$this->getMetaManager()->setNodeMeta($changeNewNode, array("shares" => $privateShares), false);
}
}
}
foreach ($collectedRepositories as $sharedRepoId => $parentRepositoryPath) {
$modifiedDifferentNodes += $this->moveSharesFromMetaRecursive(new AJXP_Node("pydio://" . $sharedRepoId . "/"), $delete, $changeOldNode->getPath(), $changeNewNode->getPath(), $parentRepositoryPath);
}
}
}
return $modifiedDifferentNodes;
}
示例2: findMirrorNodesInShares
/**
* @param AJXP_Node $node
* @param String|null $direction "UP", "DOWN"
* @return array()
*/
private function findMirrorNodesInShares($node, $direction)
{
$result = array();
if ($direction !== "UP") {
$upmetas = array();
$this->getShareStore()->getMetaManager()->collectSharesInParent($node, $upmetas);
foreach ($upmetas as $metadata) {
if (is_array($metadata) && !empty($metadata["shares"])) {
foreach ($metadata["shares"] as $sId => $sData) {
$type = $sData["type"];
if ($type == "file") {
continue;
}
$wsId = $sId;
if ($type == "minisite") {
$minisiteData = $this->getShareStore()->loadShare($sId);
if (empty($minisiteData) || !isset($minisiteData["REPOSITORY"])) {
continue;
}
$wsId = $minisiteData["REPOSITORY"];
} else {
if ($type == "ocs_remote") {
continue;
}
}
$sharedNode = $metadata["SOURCE_NODE"];
$sharedPath = substr($node->getPath(), strlen($sharedNode->getPath()));
$sharedNodeUrl = $node->getScheme() . "://" . $wsId . $sharedPath;
$result[$wsId] = array(new AJXP_Node($sharedNodeUrl), "DOWN");
$this->logDebug('MIRROR NODES', 'Found shared in parent - register node ' . $sharedNodeUrl);
}
}
}
}
if ($direction !== "DOWN") {
if ($node->getRepository()->hasParent()) {
$parentRepoId = $node->getRepository()->getParentId();
$parentRepository = ConfService::getRepositoryById($parentRepoId);
if (!empty($parentRepository) && !$parentRepository->isTemplate) {
$currentRoot = $node->getRepository()->getOption("PATH");
$owner = $node->getRepository()->getOwner();
$resolveUser = null;
if ($owner != null) {
$resolveUser = ConfService::getConfStorageImpl()->createUserObject($owner);
}
$parentRoot = $parentRepository->getOption("PATH", false, $resolveUser);
$relative = substr($currentRoot, strlen($parentRoot));
$relative = SystemTextEncoding::toStorageEncoding($relative);
$parentNodeURL = $node->getScheme() . "://" . $parentRepoId . $relative . $node->getPath();
$this->logDebug("action.share", "Should trigger on " . $parentNodeURL);
$parentNode = new AJXP_Node($parentNodeURL);
if ($owner != null) {
$parentNode->setUser($owner);
}
$result[$parentRepoId] = array($parentNode, "UP");
}
}
}
return $result;
}