[Koha-patches] [PATCH] C4::Installer - new method to get available MARC frameworks

Galen Charlton galen.charlton at liblime.com
Sat May 10 01:08:11 CEST 2008


For use by test suite; not a user-visible change.
---
 C4/Installer.pm |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/C4/Installer.pm b/C4/Installer.pm
index a497b43..25918c0 100644
--- a/C4/Installer.pm
+++ b/C4/Installer.pm
@@ -84,6 +84,30 @@ sub new {
     return $self;
 }
 
+=head2 marcflavour_list
+
+=over 4
+
+my ($marcflavours) = $installer->marcflavour_list($lang);
+
+=back
+
+Return a arrayref of the MARC flavour sets available for the
+specified language C<$lang>.  Returns 'undef' if a directory
+for the language does not exist.
+
+=cut
+
+sub marcflavour_list {
+    my $self = shift;
+    my $lang = shift;
+
+    my $dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/$lang/marcflavour";
+    opendir(MYDIR, $dir) or return;
+    my @list = grep { !/^\.|CVS/ && -d "$dir/$_" } readdir(MYDIR);
+    closedir MYDIR;
+    return \@list;
+}
 
 =head2 marc_framework_sql_list
 
-- 
1.5.5.rc0.16.g02b00




More information about the Koha-patches mailing list