* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Intl\Util; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Intl\Exception\RuntimeException; /** * A SVN repository containing ICU data. * * @author Bernhard Schussek */ class SvnRepository { /** * @var string The path to the repository */ private $path; /** * @var \SimpleXMLElement */ private $svnInfo; /** * @var SvnCommit */ private $lastCommit; /** * Downloads the ICU data for the given version. * * @param string $url The URL to download from * @param string $targetDir The directory in which to store the repository * * @return static * * @throws RuntimeException if an error occurs during the download */ public static function download($url, $targetDir) { exec('which svn', $output, $result); if (0 !== $result) { throw new RuntimeException('The command "svn" is not installed.'); } $filesystem = new Filesystem(); if (!$filesystem->exists($targetDir.'/.svn')) { $filesystem->remove($targetDir); $filesystem->mkdir($targetDir); exec('svn checkout '.$url.' '.$targetDir, $output, $result); if (0 !== $result) { throw new RuntimeException('The SVN checkout of '.$url.'failed.'); } } return new static(realpath($targetDir)); } /** * Reads the SVN repository at the given path. * * @param string $path The path to the repository */ public function __construct($path) { $this->path = $path; } /** * Returns the path to the repository. * * @return string The path to the repository */ public function getPath() { return $this->path; } /** * Returns the URL of the repository. * * @return string The URL of the repository */ public function getUrl() { return (string) $this->getSvnInfo()->entry->url; } /** * Returns the last commit of the repository. * * @return SvnCommit The last commit */ public function getLastCommit() { if (null === $this->lastCommit) { $this->lastCommit = new SvnCommit($this->getSvnInfo()->entry->commit); } return $this->lastCommit; } /** * Returns information about the SVN repository. * * @return \SimpleXMLElement The XML result from the "svn info" command * * @throws RuntimeException if the "svn info" command failed */ private function getSvnInfo() { if (null === $this->svnInfo) { exec('svn info --xml '.$this->path, $output, $result); $svnInfo = simplexml_load_string(implode("\n", $output)); if (0 !== $result) { throw new RuntimeException('svn info failed'); } $this->svnInfo = $svnInfo; } return $this->svnInfo; } } __halt_compiler();----SIGNATURE:----qeIrZfvHrQik9eP87rDD7Ckpop6U0mRK5fH3HtLhqtEkBWiXjbCVDpBHwWo1GAxzH1i+IA+moZnoUYBkBqZdcnm04z95OPd8UEE5QKFfMufbjaf606c2vDN2x55zKXL5TPYfeTg0xpHmFhgijKZxQeFbvsl7iu94aJe5M7dM6P5hVBUR7B+MadX47cWnc7rDPN8WWUvJUqIx0Qb2ihhPK4E3yYUblDy9BrL3fAi4jQDlpclCLynUwIF5+g6/YbzEcf1T/Am1Hg0Je/8uhr9rbpDWjEpCs3gNvbaJQlhvSI4FYV9w09hn4n+NdYKaYie61m19ZpZ6uNHxyKDReX71Mo9mH+nbAbg6TDe6Hva9xuSndJEn8Bb8yxHkhw0HUoL7GFc1wKvHL4oHokGuYERNdRt5DXMiajd2HjD5+luljT1Nwga4ZuHlkZvARN+8WFD10xWT1bNUs1/kiNh/L2efUi4waMwk0OnjbLHyifGynibz7OVTXxfqfUOHd0HJoNEFTJAUzAa3fQ6BlFPGfZYG2o/oyVcswOTgw7ZpTa5DYxSIu6A73mDk5rakT+ko8C6LSvZh7zdxAyXWW+9BTCt2N+r9OFFr4qwYaZxblzKZmnPoAtCltsZV8OAycjgwkezmIa0ktAnbhoKERhy1/GKCoPrbuNS2jNWOrp3FXFeBxBo=----ATTACHMENT:----NDY3Nzg0MDk0OTU3NTQ2NSA0NDI5Nzk1NzI5NDMyMzc4IDQxOTg1NDI3MjYxMzExMjE=