本文整理汇总了PHP中AJXP_Node::setLeaf方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Node::setLeaf方法的具体用法?PHP AJXP_Node::setLeaf怎么用?PHP AJXP_Node::setLeaf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Node
的用法示例。
在下文中一共展示了AJXP_Node::setLeaf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNodeData
public static function getNodeData($nodePath)
{
$basename = basename(parse_url($nodePath, PHP_URL_PATH));
if (empty($basename)) {
return ['stat' => stat(AJXP_Utils::getAjxpTmpDir())];
}
$allNodes = self::getNodes(false);
$nodeData = $allNodes[$basename];
if (!isset($nodeData["stat"])) {
if (in_array(pathinfo($basename, PATHINFO_EXTENSION), array("error", "invitation"))) {
$stat = stat(AJXP_Utils::getAjxpTmpDir());
} else {
$url = $nodeData["url"];
$node = new AJXP_Node($nodeData["url"]);
$node->getRepository()->driverInstance = null;
try {
ConfService::loadDriverForRepository($node->getRepository());
$node->getRepository()->detectStreamWrapper(true);
if ($node->getRepository()->hasContentFilter()) {
$node->setLeaf(true);
}
AJXP_Controller::applyHook("node.read", array(&$node));
$stat = stat($url);
} catch (Exception $e) {
$stat = stat(AJXP_Utils::getAjxpTmpDir());
}
if (is_array($stat) && AuthService::getLoggedUser() != null) {
$acl = AuthService::getLoggedUser()->mergedRole->getAcl($nodeData["meta"]["shared_repository_id"]);
if ($acl == "r") {
self::disableWriteInStat($stat);
}
}
self::$output[$basename]["stat"] = $stat;
}
$nodeData["stat"] = $stat;
}
return $nodeData;
}
示例2: mkDir
public function mkDir($crtDir, $newDirName, $ignoreExists = false)
{
$currentNodeDir = new AJXP_Node($this->urlBase . $crtDir);
AJXP_Controller::applyHook("node.before_change", array(&$currentNodeDir));
$mess = ConfService::getMessages();
if ($newDirName == "") {
return "{$mess['37']}";
}
if (file_exists($this->urlBase . "{$crtDir}/{$newDirName}")) {
if ($ignoreExists) {
return null;
}
return "{$mess['40']}";
}
if (!$this->isWriteable($this->urlBase . "{$crtDir}")) {
return $mess[38] . " {$crtDir} " . $mess[99];
}
$dirMode = 0775;
$chmodValue = $this->repository->getOption("CHMOD_VALUE");
if (isset($chmodValue) && $chmodValue != "") {
$dirMode = octdec(ltrim($chmodValue, "0"));
if ($dirMode & 0400) {
$dirMode |= 0100;
}
// User is allowed to read, allow to list the directory
if ($dirMode & 040) {
$dirMode |= 010;
}
// Group is allowed to read, allow to list the directory
if ($dirMode & 04) {
$dirMode |= 01;
}
// Other are allowed to read, allow to list the directory
}
$old = umask(0);
mkdir($this->urlBase . "{$crtDir}/{$newDirName}", $dirMode);
umask($old);
$newNode = new AJXP_Node($this->urlBase . $crtDir . "/" . $newDirName);
$newNode->setLeaf(false);
AJXP_Controller::applyHook("node.change", array(null, $newNode, false));
return null;
}
示例3: clearWorkspaceNodeInfos
/**
* @param Repository $repositoryObject
*/
public function clearWorkspaceNodeInfos($repositoryObject)
{
$cDriver = ConfService::getCacheDriverImpl();
if (empty($cDriver) || !$cDriver->supportsPatternDelete(AJXP_CACHE_SERVICE_NS_NODES)) {
return;
}
$node = new AJXP_Node("pydio://" . $repositoryObject->getId() . "/");
$node->setLeaf(false);
$this->clearCacheForNode($node);
}
示例4: copyOrMoveFile
/**
* @param String $destDir url of destination dir
* @param String $srcFile url of source file
* @param Array $error accumulator for error messages
* @param Array $success accumulator for success messages
* @param bool $move Whether to copy or move
* @param array $srcRepoData Set of data concerning source repository: base_url, wrapper_name and recycle option
* @param array $destRepoData Set of data concerning destination repository: base_url, wrapper_name and chmod option
*/
protected function copyOrMoveFile($destDir, $srcFile, &$error, &$success, $move = false, $srcRepoData = array(), $destRepoData = array())
{
$srcUrlBase = $srcRepoData['base_url'];
$srcWrapperName = $srcRepoData['wrapper_name'];
$srcRecycle = $srcRepoData['recycle'];
$destUrlBase = $destRepoData['base_url'];
$destWrapperName = $destRepoData['wrapper_name'];
$mess = ConfService::getMessages();
$bName = basename($srcFile);
$localName = '';
AJXP_Controller::applyHook("dl.localname", array($srcFile, &$localName, $srcWrapperName));
if (!empty($localName)) {
$bName = $localName;
}
$destFile = $destUrlBase . $destDir . "/" . $bName;
$realSrcFile = $srcUrlBase . $srcFile;
if (is_dir(dirname($realSrcFile)) && strpos($destFile, rtrim($realSrcFile, "/") . "/") === 0) {
$error[] = $mess[101];
return;
}
if (!file_exists($realSrcFile)) {
$error[] = $mess[100] . $srcFile;
return;
}
if (!$move) {
if (method_exists($this, "filesystemFileSize")) {
$size = $this->filesystemFileSize($realSrcFile);
} else {
$size = filesize($realSrcFile);
}
AJXP_Controller::applyHook("node.before_create", array(new AJXP_Node($destFile), $size));
}
if (dirname($realSrcFile) == dirname($destFile)) {
if ($move) {
$error[] = $mess[101];
return;
} else {
$base = basename($srcFile);
$i = 1;
if (is_file($realSrcFile)) {
$dotPos = strrpos($base, ".");
if ($dotPos > -1) {
$radic = substr($base, 0, $dotPos);
$ext = substr($base, $dotPos);
}
}
// auto rename file
$i = 1;
$newName = $base;
while (file_exists($destUrlBase . $destDir . "/" . $newName)) {
$suffix = "-{$i}";
if (isset($radic)) {
$newName = $radic . $suffix . $ext;
} else {
$newName = $base . $suffix;
}
$i++;
}
$destFile = $destUrlBase . $destDir . "/" . $newName;
}
}
$srcNode = new AJXP_Node($realSrcFile);
$destNode = new AJXP_Node($destFile);
if (!is_file($realSrcFile)) {
$errors = array();
$succFiles = array();
$srcNode->setLeaf(false);
if ($move) {
AJXP_Controller::applyHook("node.before_path_change", array($srcNode));
if (file_exists($destFile)) {
$this->deldir($destFile, $destRepoData);
}
$res = rename($realSrcFile, $destFile);
} else {
$dirRes = $this->dircopy($realSrcFile, $destFile, $errors, $succFiles, false, true, $srcRepoData, $destRepoData);
}
if (count($errors) || isset($res) && $res !== true) {
$error[] = $mess[114];
return;
} else {
$destNode->setLeaf(false);
AJXP_Controller::applyHook("node.change", array($srcNode, $destNode, !$move));
}
} else {
if ($move) {
AJXP_Controller::applyHook("node.before_path_change", array($srcNode));
if (file_exists($destFile)) {
unlink($destFile);
}
if (strcmp($srcWrapperName, $destWrapperName) === 0) {
$res = rename($realSrcFile, $destFile);
//.........这里部分代码省略.........
示例5: processReadHook
public function processReadHook(AJXP_Node $node)
{
$ids = $this->getWatchesOnNode($node, self::$META_WATCH_READ);
$notif = new AJXP_Notification();
$notif->setAction(AJXP_NOTIF_NODE_VIEW);
$notif->setNode($node);
if (count($ids)) {
foreach ($ids as $id) {
$this->notificationCenter->postNotification($notif, $id);
}
}
if (!$node->isRoot()) {
$parentNode = new AJXP_Node(dirname($node->getUrl()));
$parentNode->setLeaf(false);
$ids = $this->getWatchesOnNode($parentNode, self::$META_WATCH_READ);
if (count($ids)) {
// POST NOW : PARENT FOLDER IS AFFECTED
$parentNotif = new AJXP_Notification();
$parentNotif->setNode($parentNode);
$parentNotif->setAction(AJXP_NOTIF_NODE_VIEW);
$this->notificationCenter->prepareNotification($notif);
$parentNotif->addRelatedNotification($notif);
foreach ($ids as $id) {
$this->notificationCenter->postNotification($parentNotif, $id);
}
}
}
}
示例6: delete
public function delete($selectedFiles, &$logMessages)
{
$repoData = array('base_url' => $this->urlBase, 'chmod' => $this->repository->getOption('CHMOD_VALUE'), 'recycle' => $this->repository->getOption('RECYCLE_BIN'));
$mess = ConfService::getMessages();
foreach ($selectedFiles as $selectedFile) {
if ($selectedFile == "" || $selectedFile == DIRECTORY_SEPARATOR) {
return $mess[120];
}
$fileToDelete = $this->urlBase . $selectedFile;
if (!file_exists($fileToDelete)) {
$logMessages[] = $mess[100] . " " . SystemTextEncoding::toUTF8($selectedFile);
continue;
}
$node = new AJXP_Node($fileToDelete);
$node->setLeaf(!is_dir($fileToDelete));
$this->deldir($fileToDelete, $repoData);
if ($node->isLeaf()) {
$logMessages[] = "{$mess['38']} " . SystemTextEncoding::toUTF8($selectedFile) . " {$mess['44']}.";
} else {
$logMessages[] = "{$mess['34']} " . SystemTextEncoding::toUTF8($selectedFile) . " {$mess['44']}.";
}
AJXP_Controller::applyHook("node.change", [$node]);
}
return null;
}