Bugzilla – Attachment 39313 Details for
Bug 12017
Move language description out of database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12017 - 10 - Remove description from getLanguage
Bug-12017---10---Remove-description-from-getLangua.patch (text/plain), 4.11 KB, created by
Bernardo Gonzalez Kriegel
on 2015-05-19 18:11:23 UTC
(
hide
)
Description:
Bug 12017 - 10 - Remove description from getLanguage
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2015-05-19 18:11:23 UTC
Size:
4.11 KB
patch
obsolete
>From 542faf9a2ad5a7ac095d3a8060cf09b92082cb7e Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Sun, 27 Apr 2014 22:29:20 -0300 >Subject: [PATCH] Bug 12017 - 10 - Remove description from getLanguage > >This patch rewrites getLanguage function. >This function is of not much use, but is >rewrited to takes its data from language_rfc4646_to_iso639 >table. > >To test: >1. Apply the patch >2. Only place that use this function is t/db_dependent/Languages.t >so run the test and check that it pass >3. To compare the output pre and post patch you can run >perl -e 'use C4::Languages; use Data::Dumper; $a = getLanguages(); print Dumper $a;' >--- > C4/Languages.pm | 39 +++------------------------------------ > 1 file changed, 3 insertions(+), 36 deletions(-) > >diff --git a/C4/Languages.pm b/C4/Languages.pm >index 81a684c..bb0bd9b 100644 >--- a/C4/Languages.pm >+++ b/C4/Languages.pm >@@ -47,7 +47,7 @@ BEGIN { > &getLanguages > &getAllLanguages > ); >- @EXPORT_OK = qw(getSearchLanguages getLanguages_iso getTranslatedLanguages getAllLanguages getLanguages get_bidi regex_lang_subtags language_get_description accept_language getlanguage); >+ @EXPORT_OK = qw(getSearchLanguages getLanguages_iso getTranslatedLanguages getAllLanguages getLanguages get_bidi regex_lang_subtags accept_language getlanguage); > $DEBUG = 0; > } > >@@ -265,43 +265,10 @@ sub getLanguages { > if ($lang) { > $current_language = regex_lang_subtags($lang)->{'language'}; > } >- my $sth = $dbh->prepare('SELECT * FROM language_subtag_registry WHERE type=\'language\''); >+ my $sth = $dbh->prepare('SELECT * FROM language_rfc4646_to_iso639'); > $sth->execute(); > while (my $language_subtag_registry = $sth->fetchrow_hashref) { >- my $desc; >- # check if language name is stored in current language >- my $sth4= $dbh->prepare("SELECT description FROM language_descriptions WHERE type='language' AND subtag =? AND lang = ?"); >- $sth4->execute($language_subtag_registry->{subtag},$current_language); >- while (my $language_desc = $sth4->fetchrow_hashref) { >- $desc=$language_desc->{description}; >- } >- my $sth2= $dbh->prepare("SELECT * FROM language_descriptions LEFT JOIN language_rfc4646_to_iso639 on language_rfc4646_to_iso639.rfc4646_subtag = language_descriptions.subtag WHERE type='language' AND subtag =? AND language_descriptions.lang = ?"); >- if ($desc) { >- $sth2->execute($language_subtag_registry->{subtag},$current_language); >- } >- else { >- $sth2->execute($language_subtag_registry->{subtag},$default_language); >- } >- my $sth3 = $dbh->prepare("SELECT description FROM language_descriptions WHERE type='language' AND subtag=? AND lang=?"); >- # add the correct description info >- while (my $language_descriptions = $sth2->fetchrow_hashref) { >- $sth3->execute($language_subtag_registry->{subtag},$language_subtag_registry->{subtag}); >- my $native_description; >- while (my $description = $sth3->fetchrow_hashref) { >- $native_description = $description->{description}; >- } >- >- # fill in the ISO6329 code >- $language_subtag_registry->{iso639_2_code} = $language_descriptions->{iso639_2_code}; >- # fill in the native description of the language, as well as the current language's translation of that if it exists >- if ($native_description) { >- $language_subtag_registry->{language_description} = $native_description; >- $language_subtag_registry->{language_description}.=" ($language_descriptions->{description})" if $language_descriptions->{description}; >- } >- else { >- $language_subtag_registry->{language_description} = $language_descriptions->{description}; >- } >- } >+ $language_subtag_registry->{subtag} = $language_subtag_registry->{rfc4646_subtag}; > if ( !$language_list || index ( $language_list, $language_subtag_registry->{ iso639_2_code } ) >= 0) { > push @languages_loop, $language_subtag_registry; > } >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12017
:
26691
|
26694
|
26735
|
26736
|
26770
|
27687
|
27688
|
27689
|
27690
|
27691
|
27692
|
27693
|
27694
|
27695
|
27696
|
29898
|
29899
|
29900
|
29901
|
29902
|
29903
|
29904
|
29905
|
29906
|
29907
|
33337
|
33338
|
33339
|
33340
|
33341
|
33342
|
33343
|
33344
|
33345
|
33346
|
39304
|
39305
|
39306
|
39307
|
39308
|
39309
|
39310
|
39311
|
39312
|
39313
|
39644
|
39655
|
39656
|
39657
|
39658
|
39659
|
39660
|
39661
|
39662
|
39663
|
39664
|
39665
|
40285
|
40286
|
40287
|
40288
|
40289
|
40290
|
40291
|
40292
|
40293
|
40294
|
40295