summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorwurblzap%gmail.com <>2007-08-22 03:47:51 +0200
committerwurblzap%gmail.com <>2007-08-22 03:47:51 +0200
commitc56f5e3c03177edf52172c8a164f66c354d0e147 (patch)
treecaef8b053a3031404d31d7c1d9dca2b202e44e70 /Bugzilla.pm
parent5a1fdacb12095b417382c15186e5aaaec7eed3a1 (diff)
downloadbugzilla-c56f5e3c03177edf52172c8a164f66c354d0e147.tar.gz
bugzilla-c56f5e3c03177edf52172c8a164f66c354d0e147.tar.xz
Bug 365378 – The 'languages' parameter is not necessary.
Patch by Marc Schumann <wurblzap@gmail.com>; r=LpSolit; a=LpSolit
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index e4947fbe1..47cf256ff 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -40,6 +40,7 @@ use Bugzilla::Util;
use Bugzilla::Field;
use File::Basename;
+use File::Spec::Functions;
use Safe;
# This creates the request cache for non-mod_perl installations.
@@ -308,6 +309,24 @@ sub dbh {
return request_cache()->{dbh};
}
+sub languages {
+ return request_cache()->{languages} if request_cache()->{languages};
+
+ my @files = glob(catdir(bz_locations->{'templatedir'}, '*'));
+ my @languages;
+ foreach my $dir_entry (@files) {
+ # It's a language directory only if it contains "default" or
+ # "custom". This auto-excludes CVS directories as well.
+ next unless (-d catdir($dir_entry, 'default')
+ || -d catdir($dir_entry, 'custom'));
+ $dir_entry = basename($dir_entry);
+ # Check for language tag format conforming to RFC 1766.
+ next unless $dir_entry =~ /^[a-zA-Z]{1,8}(-[a-zA-Z]{1,8})?$/;
+ push(@languages, $dir_entry);
+ }
+ return request_cache()->{languages} = \@languages;
+}
+
sub error_mode {
my $class = shift;
my $newval = shift;
@@ -627,6 +646,11 @@ used to automatically answer or skip prompts.
The current database handle. See L<DBI>.
+=item C<languages>
+
+Currently installed languages.
+Returns a reference to a list of RFC 1766 language tags of installed languages.
+
=item C<switch_to_shadow_db>
Switch from using the main database to using the shadow database.