1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Fix spurious errors from Catalog::create()

is_readable is flaky under Windows, opendir should be more accurate.
This commit is contained in:
Paul Arthur 2012-10-18 17:48:14 -04:00 committed by Paul Arthur
parent 8821554dda
commit bea34c4261
2 changed files with 12 additions and 3 deletions

View file

@ -2,6 +2,11 @@
--------- Ampache -- CHANGELOG ---------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
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

View file

@ -275,10 +275,14 @@ 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') {
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
$sql = "SELECT `id` FROM `catalog` WHERE `path`='$path'";