summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Arthur <flowerysong00@yahoo.com>2012-10-18 17:48:14 -0400
committerPaul Arthur <paul.arthur@flowerysong.com>2012-10-18 18:16:30 -0400
commitbea34c42613c10a12b9bd65318de0a799c2db030 (patch)
treeca14de74c7a9addf6fa787da70ee87d94b6c9ff9
parent8821554dda12dc6f75b7cdb5985adea184e038a0 (diff)
downloadampache-bea34c42613c10a12b9bd65318de0a799c2db030.tar.gz
ampache-bea34c42613c10a12b9bd65318de0a799c2db030.tar.bz2
ampache-bea34c42613c10a12b9bd65318de0a799c2db030.zip
Fix spurious errors from Catalog::create()
is_readable is flaky under Windows, opendir should be more accurate.
-rwxr-xr-xdocs/CHANGELOG5
-rw-r--r--lib/class/catalog.class.php10
2 files changed, 12 insertions, 3 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 2379d56c..f2ef51fd 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -3,6 +3,11 @@
--------------------------------------------------------------------------
--------------------------------------------------------------------------
+ v.3.6-future
+ - Fixed an issue with adding catalogs on Windows caused by inconsistent
+ behaviour of is_readable() (reported by Lockzi)
+
+--------------------------------------------------------------------------
v.3.6-Alpha3 2012-10-15
- Updated getID3 to 1.9.4b1
- Removed support for extremely old passwords
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index 4dc46c53..9057547b 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -275,9 +275,13 @@ class Catalog extends database_object {
$path = Dba::escape($data['path']);
// Make sure the path is readable/exists
- if (!is_readable($data['path']) AND $data['type'] == 'local') {
- Error::add('general', sprintf(T_('Error: %s is not readable or does not exist'), scrub_out($data['path'])));
- return false;
+ if ($data['type'] == 'local') {
+ $handle = opendir($path);
+ if ($handle === false) {
+ Error::add('general', sprintf(T_('Error: %s is not readable or does not exist'), scrub_out($data['path'])));
+ return false;
+ }
+ closedir($handle);
}
// Make sure this path isn't already in use by an existing catalog