3 # Copyright Pat Eyler 2003
4 # Copyright Biblibre 2006
5 # Parts Copyright Liblime 2008
6 # Parts Copyright Chris Nighswonger 2010
8 # This file is part of Koha.
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 use C4::Update::Database;
37 #use Smart::Comments '####';
40 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
42 template_name => "about.tmpl",
46 flagsrequired => { catalogue => 1 },
51 my $kohaVersion = C4::Context->preference("Version");
52 # restore ., for display consistency
53 $kohaVersion =~ /(.)\.(..)(..)(...)/;
54 # transform digits to Perl number, to display 3.6.1.2 instead of 3.06.01.002
55 $kohaVersion = ($1+0).".".($2+0).".".($3+0).".".($4+0);
57 my $dbrev_applied=""; # the list of database revisions
59 # the $kohaVersion is duplicated since 3.7: the 3.6 (that uses the old mechanism) and the 3.7 (new mechanism).
60 # Both versions reflects how the database has been upgraded
61 my $already_applied = C4::Update::Database::list_versions_already_applied();
62 # $last_known contains the previous DBrev applied number (all . removed). It's used to have a . instead of a number in case of continuous updates
64 # $last_known_sep contains the previous DBrev applied with the separator (used for display)
65 my $last_known_sep="";
66 for my $v ( @$already_applied ) {
67 my $current = $v->{version};
69 # if the current number is the previous one +1, then just add a ., for a better display N.........N+10, for example
70 # (instead of N / N+1 / N+2 / ...)
71 if ($current==$last_known+1) {
73 } else { # we're not N+1, start a new range
74 # if version don't end by a ., no need to add the current loop number
75 # this avoid having N...N (in case of an isolated BDrev number)
76 if ($last_known & $dbrev_applied =~ /\.$/) {
77 $dbrev_applied .= "...".$last_known_sep;
80 $dbrev_applied .= " ".$v->{version};
82 $last_known= $current;
83 $last_known_sep=$v->{version};
85 # add the last DB rev number, we don't want to end with "..."
86 if ($dbrev_applied =~ /\.$/) {
87 $dbrev_applied .= "...".$last_known_sep;
90 my $osVersion = `uname -a`;
93 $perl_path .= $Config{_exe} unless $perl_path =~ m/$Config{_exe}$/i;
96 my $mysqlVersion = `mysql -V`;
97 my $apacheVersion = `httpd -v 2> /dev/null`;
98 $apacheVersion = `httpd2 -v 2> /dev/null` unless $apacheVersion;
99 $apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
100 my $zebraVersion = `zebraidx -V`;
102 # Additional system information for warnings
103 my $prefNoZebra = C4::Context->preference('nozebra');
104 my $prefAutoCreateAuthorities = C4::Context->preference('AutoCreateAuthorities');
105 my $prefBiblioAddsAuthorities = C4::Context->preference('BiblioAddsAuthorities');
106 my $warnPrefBiblioAddsAuthorities = ( $prefAutoCreateAuthorities && ( !$prefBiblioAddsAuthorities) );
108 my $prefEasyAnalyticalRecords = C4::Context->preference('EasyAnalyticalRecords');
109 my $prefUseControlNumber = C4::Context->preference('UseControlNumber');
110 my $warnPrefEasyAnalyticalRecords = ( $prefEasyAnalyticalRecords && $prefUseControlNumber );
112 my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
114 my $warnIsRootUser = (! $loggedinuser);
117 kohaVersion => $kohaVersion,
118 dbrev_applied => $dbrev_applied,
119 osVersion => $osVersion,
120 perlPath => $perl_path,
121 perlVersion => $perlVersion,
122 perlIncPath => [ map { perlinc => $_ }, @INC ],
123 mysqlVersion => $mysqlVersion,
124 apacheVersion => $apacheVersion,
125 zebraVersion => $zebraVersion,
126 prefNoZebra => $prefNoZebra,
127 prefBiblioAddsAuthorities => $prefBiblioAddsAuthorities,
128 prefAutoCreateAuthorities => $prefAutoCreateAuthorities,
129 warnPrefBiblioAddsAuthorities => $warnPrefBiblioAddsAuthorities,
130 warnPrefEasyAnalyticalRecords => $warnPrefEasyAnalyticalRecords,
131 errZebraConnection => $errZebraConnection,
132 warnIsRootUser => $warnIsRootUser,
137 my $perl_modules = C4::Installer::PerlModules->new;
138 $perl_modules->version_info;
140 my @pm_types = qw(missing_pm upgrade_pm current_pm);
142 foreach my $pm_type(@pm_types) {
143 my $modules = $perl_modules->get_attr($pm_type);
144 foreach (@$modules) {
145 my ($module, $stats) = each %$_;
150 version => $stats->{'cur_ver'},
151 missing => ($pm_type eq 'missing_pm' ? 1 : 0),
152 upgrade => ($pm_type eq 'upgrade_pm' ? 1 : 0),
153 current => ($pm_type eq 'current_pm' ? 1 : 0),
154 require => $stats->{'required'},
160 @components = sort {$a->{'name'} cmp $b->{'name'}} @components;
165 foreach (@components) {
167 unless (++$counter % 4) {
168 push (@$table, {row => $row});
172 # Processing the last line (if there are any modules left)
173 if (scalar(@$row) > 0) {
174 # Extending $row to the table size
176 # Pushing the last line
177 push (@$table, {row => $row});
181 $template->param( table => $table );
184 ## ------------------------------------------
185 ## Koha time line code
188 my $dir = C4::Context->config('intranetdir');
189 open( my $file, "<", "$dir" . "/docs/history.txt" );
198 shift @lines; #remove header row
201 my ( $date, $desc, $tag ) = split(/\t/);
202 if(!$desc && $date=~ /(?<=\d{4})\s+/) {
203 ($date, $desc)= ($`, $');
215 #foreach my $row2 (@rows2) {
218 push( @$table2, { row2 => $row2 } );
222 $template->param( table2 => $table2 );
224 output_html_with_http_headers $query, $cookie, $template->output;