svnlib::common::isdir() speed up
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 28 Aug 2005 23:19:09 +0000 (23:19 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 28 Aug 2005 23:19:09 +0000 (23:19 +0000)
includes/svnlib.php

index cfa15fffc45df0fb87064ff11cac7b147a382069..0a5a9bd53fda3ad8dd0d52becb7b9f4841e4ad42 100644 (file)
@@ -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;
        }
        
        /**