diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-21 06:53:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-11-21 06:53:20 +0000 |
commit | 8d914e47c9ecb0c99f63ba50936a09e2184eaf84 (patch) | |
tree | 31302f42d5399ed10af3c75c7faad5ed3b0d0bbe /lib/class/catalog.class.php | |
parent | 794036ac1f462f302ce71e64132d981f69023e09 (diff) | |
download | ampache-8d914e47c9ecb0c99f63ba50936a09e2184eaf84.tar.gz ampache-8d914e47c9ecb0c99f63ba50936a09e2184eaf84.tar.bz2 ampache-8d914e47c9ecb0c99f63ba50936a09e2184eaf84.zip |
additional xml methods songs & album_songs, also implemented catalog add speed improvement from Karl Hungus
Diffstat (limited to 'lib/class/catalog.class.php')
-rw-r--r-- | lib/class/catalog.class.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index a6dabbbe..76289677 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -380,6 +380,12 @@ class Catalog { Error::add('catalog_add',_('Error: Unable to open') . ' ' . $path); } + /* Change the dir so is_dir works correctly */ + if (!chdir($path)) { + debug_event('read',"Unable to chdir $path",'2','ampache-catalog'); + Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path); + } + /* Recurse through this dir and create the files array */ while ( false !== ( $file = readdir($handle) ) ) { @@ -388,11 +394,6 @@ class Catalog { debug_event('read',"Starting work on $file inside $path",'5','ampache-catalog'); - /* Change the dir so is_dir works correctly */ - if (!chdir($path)) { - debug_event('read',"Unable to chdir $path",'2','ampache-catalog'); - Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path); - } /* Create the new path */ $full_file = $path.$slash_type.$file; @@ -411,6 +412,13 @@ class Catalog { /* If it's a dir run this function again! */ if (is_dir($full_file)) { $this->add_files($full_file,$options); + + /* Change the dir so is_dir works correctly */ + if (!chdir($path)) { + debug_event('read',"Unable to chdir $path",'2','ampache-catalog'); + Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path); + } + /* Skip to the next file */ continue; } //it's a directory |