diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-05-30 14:42:33 -0400 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-05-30 14:42:33 -0400 |
commit | 69dcc79e94bd509fb539714ab1a49fd4567439ce (patch) | |
tree | 36bbd7fc2c5836c8612fe085eca6347c583f1bdc /lib/class/catalog.class.php | |
parent | 53aff101bf61807c9341a09b5df54e3211573c38 (diff) | |
download | ampache-69dcc79e94bd509fb539714ab1a49fd4567439ce.tar.gz ampache-69dcc79e94bd509fb539714ab1a49fd4567439ce.tar.bz2 ampache-69dcc79e94bd509fb539714ab1a49fd4567439ce.zip |
Add and use Core::is_readable()
bea34c42 fixed one use of is_readable, but Windows users encountering
this issue would still be affected in other cases. This commit fixes
all of the important is_readable calls within Ampache; I'm not going
to hack this into external modules, so if they're broken people will
have to live with it.
Diffstat (limited to 'lib/class/catalog.class.php')
-rw-r--r-- | lib/class/catalog.class.php | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 73e8b479..89167eca 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -217,13 +217,11 @@ class Catalog extends database_object { // Make sure the path is readable/exists if ($data['type'] == 'local') { - $handle = opendir($path); - if ($handle === false) { + if (!Core::is_readable($path)) { debug_event('catalog', 'Cannot add catalog at unopenable path ' . $path, 1); 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 @@ -501,7 +499,7 @@ class Catalog extends database_object { Error::add('catalog_add', sprintf(T_('Error: Unable to get filesize for %s'), $full_file)); } // file_size check - if (!is_readable($full_file)) { + if (!Core::is_readable($full_file)) { // not readable, warn user debug_event('read', "$full_file is not readable by ampache", 2); /* HINT: FullFile */ @@ -1175,7 +1173,7 @@ class Catalog extends database_object { * Removes local songs that no longer exist. */ private function clean_local_catalog() { - if (!is_readable($this->path)) { + if (!Core::is_readable($this->path)) { // First sanity check; no point in proceeding with an unreadable // catalog root. debug_event('catalog', 'Catalog path:' . $this->path . ' unreadable, clean failed', 1); @@ -1288,7 +1286,7 @@ class Catalog extends database_object { $dead[] = $results['id']; } //if error - else if (!is_readable($results['file'])) { + else if (!Core::is_readable($results['file'])) { debug_event('clean', $results['file'] . ' is not readable, but does exist', 1); } } @@ -1373,7 +1371,7 @@ class Catalog extends database_object { UI::update_text('verify_dir_' . $this->id, scrub_out($file)); } - if (!is_readable($row['file'])) { + if (!Core::is_readable($row['file'])) { Error::add('general', sprintf(T_('%s does not exist or is not readable'), $row['file'])); debug_event('read', $row['file'] . ' does not exist or is not readable', 5); continue; |