From e695892c8ef706cab490c85c6082a647fca80dd0 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 28 Aug 2005 23:19:09 +0000 Subject: [PATCH] svnlib::common::isdir() speed up --- includes/svnlib.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/includes/svnlib.php b/includes/svnlib.php index cfa15ff..0a5a9bd 100644 --- a/includes/svnlib.php +++ b/includes/svnlib.php @@ -333,16 +333,20 @@ class SVNCommon */ function isdir($path) { - $output = @$this->registry->svn->cat($this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), 'HEAD'); - $output = implode("\n", $output); - if (strpos($output, 'svn:') === false) - { - return false; - } - else + $output = $this->registry->svn->std('info', $this->registry->paths->fetch_repos($path), $this->registry->paths->fetch_path($path), 'HEAD'); + + foreach ($output AS $line) { - return true; + if (preg_match('#^Node Kind: (.*)#', $line, $matches)) + { + if (trim(strtolower($matches[1])) == 'directory') + { + return true; + } + } } + + return false; } /** -- 2.43.5