Overview

Packages

  • None
  • Vcs

Classes

  • Horde_Vcs
  • Horde_Vcs_Base
  • Horde_Vcs_Cvs
  • Horde_Vcs_Directory_Base
  • Horde_Vcs_Directory_Cvs
  • Horde_Vcs_Directory_Git
  • Horde_Vcs_Directory_Rcs
  • Horde_Vcs_Directory_Svn
  • Horde_Vcs_File_Base
  • Horde_Vcs_File_Cvs
  • Horde_Vcs_File_Git
  • Horde_Vcs_File_Rcs
  • Horde_Vcs_File_Svn
  • Horde_Vcs_Git
  • Horde_Vcs_Log_Base
  • Horde_Vcs_Log_Cvs
  • Horde_Vcs_Log_Git
  • Horde_Vcs_Log_Rcs
  • Horde_Vcs_Log_Svn
  • Horde_Vcs_Patchset
  • Horde_Vcs_Patchset_Base
  • Horde_Vcs_Patchset_Cvs
  • Horde_Vcs_Patchset_Git
  • Horde_Vcs_Patchset_Svn
  • Horde_Vcs_QuickLog_Base
  • Horde_Vcs_QuickLog_Cvs
  • Horde_Vcs_QuickLog_Git
  • Horde_Vcs_QuickLog_Rcs
  • Horde_Vcs_QuickLog_Svn
  • Horde_Vcs_Rcs
  • Horde_Vcs_Svn
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Subversion directory class that stores information about the files in a
 4:  * single directory in the repository.
 5:  *
 6:  * @author  Anil Madhavapeddy <anil@recoil.org>
 7:  * @author  Michael Slusarz <slusarz@horde.org>
 8:  * @author  Jan Schneider <jan@horde.org>
 9:  * @package Vcs
10:  */
11: class Horde_Vcs_Directory_Svn extends Horde_Vcs_Directory_Base
12: {
13:     /**
14:      * Constructor.
15:      *
16:      * @param Horde_Vcs_Base $rep  A repository object.
17:      * @param string $dn           Path to the directory.
18:      * @param array $opts          Any additional options:
19:      *
20:      * @throws Horde_Vcs_Exception
21:      */
22:     public function __construct(Horde_Vcs_Base $rep, $dn, $opts = array())
23:     {
24:         parent::__construct($rep, $dn, $opts);
25: 
26:         $cmd = $rep->getCommand() . ' ls '
27:             . escapeshellarg($rep->sourceroot . $this->_dirName);
28: 
29:         $dir = proc_open(
30:             $cmd,
31:             array(1 => array('pipe', 'w'), 2 => array('pipe', 'w')),
32:             $pipes);
33:         if (!$dir) {
34:             throw new Horde_Vcs_Exception('Failed to execute svn ls: ' . $cmd);
35:         }
36:         if ($error = stream_get_contents($pipes[2])) {
37:             proc_close($dir);
38:             throw new Horde_Vcs_Exception($error);
39:         }
40: 
41:         /* Create two arrays - one of all the files, and the other of all the
42:          * dirs. */
43:         $errors = array();
44:         while (!feof($pipes[1])) {
45:             $line = chop(fgets($pipes[1], 1024));
46:             if (!strlen($line)) {
47:                 continue;
48:             }
49: 
50:             if (substr($line, 0, 4) == 'svn:') {
51:                 $errors[] = $line;
52:             } elseif (substr($line, -1) == '/') {
53:                 $this->_dirs[] = substr($line, 0, -1);
54:             } else {
55:                 $this->_files[] = $rep->getFile($this->_dirName . '/' . $line);
56:             }
57:         }
58: 
59:         proc_close($dir);
60:     }
61: }
62: 
API documentation generated by ApiGen