Lines 32-37
use warnings;
Link Here
|
32 |
|
32 |
|
33 |
# CPAN modules |
33 |
# CPAN modules |
34 |
use DBI; |
34 |
use DBI; |
|
|
35 |
use File::Find; |
36 |
use File::Copy; |
35 |
use Getopt::Long; |
37 |
use Getopt::Long; |
36 |
# Koha modules |
38 |
# Koha modules |
37 |
use C4::Context; |
39 |
use C4::Context; |
Lines 8083-8088
if ( CheckVersion($DBversion) ) {
Link Here
|
8083 |
SetVersion($DBversion); |
8085 |
SetVersion($DBversion); |
8084 |
} |
8086 |
} |
8085 |
|
8087 |
|
|
|
8088 |
$DBversion = "3.15.00.XXX"; |
8089 |
if ( CheckVersion($DBversion) ) { |
8090 |
my $sth = $dbh->prepare( q{ SELECT value FROM systempreferences |
8091 |
WHERE variable='language' } ); |
8092 |
$sth->execute(); |
8093 |
my $StaffLanguage = $sth->fetchrow; |
8094 |
$sth = $dbh->prepare( q{ SELECT value FROM systempreferences |
8095 |
WHERE variable='opaclanguages' } ); |
8096 |
$sth->execute(); |
8097 |
my $OpacLanguage = $sth->fetchrow; |
8098 |
|
8099 |
my $action = 'Nothing'; |
8100 |
|
8101 |
if ( $StaffLanguage =~ /th-THA/ ) { |
8102 |
$StaffLanguage = s/th-THA//g; |
8103 |
if ( $StaffLanguage =~ /th-TH/ ) { |
8104 |
$StaffLanguage = s/,,/,/g; |
8105 |
$action = 'Remove'; |
8106 |
} |
8107 |
else { |
8108 |
$StaffLanguage = s/,,/,th-TH,/g; |
8109 |
$action = 'Replace'; |
8110 |
} |
8111 |
$sth = $dbh->prepare( q{ UPDATE systempreferences |
8112 |
SET value=? |
8113 |
WHERE variable='language' } ); |
8114 |
$sth->execute($StaffLanguage); |
8115 |
} |
8116 |
|
8117 |
if ( $OpacLanguage =~ /th-THA/ ) { |
8118 |
$OpacLanguage = s/th-THA//g; |
8119 |
if ( $OpacLanguage =~ /th-TH/ ) { |
8120 |
$OpacLanguage = s/,,/,/g; |
8121 |
$action = 'Remove'; |
8122 |
} |
8123 |
else { |
8124 |
$OpacLanguage = s/,,/,th-TH,/g; |
8125 |
$action = 'Replace'; |
8126 |
} |
8127 |
$sth = $dbh->prepare( q{ UPDATE systempreferences |
8128 |
SET value=? |
8129 |
WHERE variable='opaclanguages' } ); |
8130 |
$sth->execute($OpacLanguage); |
8131 |
} |
8132 |
|
8133 |
my %DirList; |
8134 |
my @StaffLang; |
8135 |
my @OpacLang; |
8136 |
|
8137 |
find ( sub { $DirList{$File::Find::dir} = 1; }, |
8138 |
C4::Context->config('opachtdocs') ); |
8139 |
find ( sub { $DirList{$File::Find::dir} = 1; }, |
8140 |
C4::Context->config('intrahtdocs') ); |
8141 |
foreach my $DirName (sort keys %DirList) { |
8142 |
if ($DirName =~ /th-TH$/ || $DirName =~ /th-THA$/ ) { |
8143 |
if ($DirName =~ /intranet/) { |
8144 |
push @StaffLang, $DirName; |
8145 |
} |
8146 |
else { |
8147 |
push @OpacLang, $DirName; |
8148 |
} |
8149 |
} |
8150 |
} |
8151 |
|
8152 |
if ( $action eq 'Remove' ) { |
8153 |
foreach my $DirName (@StaffLang @OpacLang) { |
8154 |
remove_tree($DirName); |
8155 |
} |
8156 |
} |
8157 |
elsif ( $action eq 'Replace' ) { |
8158 |
foreach my $DirName (@StaffLang @OpacLang) { |
8159 |
my $destdir = $DirName; |
8160 |
$destdir = s/th-THA/th-TH/g; |
8161 |
move($DirName, $destdir); |
8162 |
} |
8163 |
} |
8164 |
|
8165 |
if ( $action eq 'Nothing' ) { |
8166 |
print "Upgrade to $DBversion done (Not applicable)\n"; |
8167 |
} |
8168 |
else { |
8169 |
print "Upgrade to $DBversion done (Bug 11393: Language menu not show up as name for Thai (th-THA was shown) )\n"; |
8170 |
} |
8171 |
SetVersion($DBversion); |
8172 |
} |
8173 |
|
8086 |
=head1 FUNCTIONS |
8174 |
=head1 FUNCTIONS |
8087 |
|
8175 |
|
8088 |
=head2 TableExists($table) |
8176 |
=head2 TableExists($table) |
8089 |
- |
|
|