svn: /pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ ReleaseFileBrowser.php

From: Date: Mon, 05 Jul 2010 19:31:51 +0000
Subject: svn: /pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ ReleaseFileBrowser.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9558@lists.php.net to get a copy of this message
gauthierm Mon, 05 Jul 2010 19:31:51 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=301008 Log: Clean up release file browser a little bit. Trailing slash on Main::channel_path is now optional. Changed paths: U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php =================================================================== --- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php 2010-07-05 17:03:02 UTC (rev 301007) +++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ReleaseFileBrowser.php 2010-07-05 19:31:51 UTC (rev 301008) @@ -1,5 +1,7 @@ <?php + namespace PEAR2\SimpleChannelFrontend; + class ReleaseFileBrowser { public $options; @@ -8,12 +10,14 @@ public $internal_file; - function __construct($options = array()) + public function __construct($options = array()) { - $file = Main::$channel_path.'/get/'.$options['release']; - if (!file_exists($file) - || dirname($file) != Main::$channel_path.'/get') { - throw new \Exception('Cannot find the package. '.$file); + $root = rtrim(Main::$channel_path, DIRECTORY_SEPARATOR); + $root = $root . DIRECTORY_SEPARATOR . 'get'; + $file = $root . DIRECTORY_SEPARATOR . $options['release']; + + if (!file_exists($file) || dirname($file) != $root) { + throw new \Exception('Cannot find the package ' . $file . '.'); } $this->release = new \PharData($file); @@ -29,4 +33,4 @@ } -} \ No newline at end of file +}

« previous php.pear.core (#9558) next »