summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-10-10 17:01:02 +0200
committerYorhel <git@yorhel.nl>2009-10-10 17:05:30 +0200
commit0c5a9606dd9047522c4357e36e5fe9081943b947 (patch)
tree494e64618856619e9bf0c4ec2d91e9b4b86d3f59 /lib/VNDB
parent64007de03cba6c0acb8a2782bc5f86bcad946850 (diff)
List all known languages on /r and /v/all instead of only those in use
Performance improvement of ~15ms for all release and VN browse pages. There are in total 20 known languages in the DB, and 12 of them are actually used (i.e. a release in that language exists). Which means 8 of the listed language filters won't produce any results (yet), but I'd say that's an accaptable trade-off.
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/DB/Misc.pm16
-rw-r--r--lib/VNDB/Handler/Releases.pm2
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm2
3 files changed, 3 insertions, 17 deletions
diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm
index eeb860b0..ed3730ee 100644
--- a/lib/VNDB/DB/Misc.pm
+++ b/lib/VNDB/DB/Misc.pm
@@ -6,7 +6,7 @@ use warnings;
use Exporter 'import';
our @EXPORT = qw|
- dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbLanguages dbRandomQuote
+ dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbRandomQuote
|;
@@ -160,20 +160,6 @@ sub dbItemMod {
}
-# Returns a list of languages actually in use
-sub dbLanguages {
- my $self = shift;
- return [
- map $_->{lang}, @{$self->dbAll(q|
- SELECT DISTINCT rl.lang
- FROM releases r
- JOIN releases_lang rl ON rl.rid = r.latest
- WHERE r.hidden = FALSE|
- )}
- ];
-}
-
-
# Returns a random quote (hashref with keys = vid, quote)
sub dbRandomQuote {
return $_[0]->dbRow(q|
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index d771d4b1..62776fd2 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -635,7 +635,7 @@ sub _filters {
txt mt '_rbrowse_languages';
b ' ('.mt('_rbrowse_boolor').')';
end;
- for my $i (sort @{$self->dbLanguages}) {
+ for my $i (@{$self->{languages}}) {
span;
input type => 'checkbox', name => 'ln', value => $i, id => "lang_$i", grep($_ eq $i, @{$f->{ln}}) ? (checked => 'checked') : ();
label for => "lang_$i";
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index b0c948cd..118a5ee2 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -162,7 +162,7 @@ sub _filters {
txt mt '_vnbrowse_lang';
b ' ('.mt('_vnbrowse_boolor').')';
end;
- for my $i (sort @{$self->dbLanguages}) {
+ for my $i (@{$self->{languages}}) {
span;
input type => 'checkbox', name => 'ln', value => $i, id => "lang_$i",
(scalar grep $_ eq $i, @{$f->{ln}}) ? (checked => 'checked') : ();