From d5b1f09dbb3eb5be057519b92514c92af3700f1e Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 2 Feb 2024 11:51:59 +0200 Subject: [PATCH] add getPagePathsByPath method --- README.md | 12 ++++++++++++ src/Dokuwiki/Filesystem.php | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/README.md b/README.md index 7419e44..dfff35d 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,18 @@ var_dump ( ) ``` +#### Filesystem::getPagePathsByPath + +Return pages under the given data directory + +``` +var_dump ( + $filesystem->getPagePathsByPath( + // absolute path to target data directory (e.g. Filesystem::getDirectoryPathByUri) + ) +) +``` + #### Filesystem::getDirectoryPathByUri #### Filesystem::getPagePathByUri diff --git a/src/Dokuwiki/Filesystem.php b/src/Dokuwiki/Filesystem.php index 1f02170..407684a 100644 --- a/src/Dokuwiki/Filesystem.php +++ b/src/Dokuwiki/Filesystem.php @@ -32,6 +32,16 @@ class Filesystem return $this->_list; } + public function getPagePathsByPath(string $path): ?array + { + if (isset($this->_tree[$path])) + { + return $this->_tree[$path]; + } + + return null; + } + public function getPagePathByUri(string $uri): ?string { $path = sprintf(