@@ -, +, @@ apply depending on DEBUG - before this patch, if you have N, N+1, N+2, N+3 and N+10 DB rev applied, about was displaying : , N+1 / N+2 / N+3 / N+10 - after this patch you have N......N+3 / N+10 --- C4/Update/Database.pm | 6 ++-- about.pl | 31 ++++++++++++++++++++ admin/updatedatabase.pl | 2 + .../prog/en/modules/admin/updatedatabase.tt | 12 ++++--- 4 files changed, 43 insertions(+), 8 deletions(-) --- a/C4/Update/Database.pm +++ a/C4/Update/Database.pm @@ -202,7 +202,7 @@ sub list_versions_already_knows { CREATE TABLE IF NOT EXISTS `updatedb_report` ( `version` text, `md5` varchar(50) DEFAULT NULL, `comment` text, `status` int(1) DEFAULT NULL ) ENGINE=InnoDB CHARSET=utf8; }); - my $query = qq/ SELECT version, comment, status FROM updatedb_report /; + my $query = qq/ SELECT version, comment, status FROM updatedb_report ORDER BY version/; my $sth = $dbh->prepare( $query ); $sth->execute; my $versions = $sth->fetchall_arrayref( {} ); @@ -214,12 +214,12 @@ sub list_versions_already_knows { } @$versions; $sth->finish; for my $version ( @$versions ) { - $query = qq/ SELECT query FROM updatedb_query WHERE version = ? /; + $query = qq/ SELECT query FROM updatedb_query WHERE version = ? ORDER BY version/; $sth = $dbh->prepare( $query ); $sth->execute( $version->{version} ); $version->{queries} = $sth->fetchall_arrayref( {} ); $sth->finish; - $query = qq/ SELECT error FROM updatedb_error WHERE version = ? /; + $query = qq/ SELECT error FROM updatedb_error WHERE version = ? ORDER BY version/; $sth = $dbh->prepare( $query ); $sth->execute( $version->{version} ); $version->{errors} = $sth->fetchall_arrayref( {} ); --- a/about.pl +++ a/about.pl @@ -47,12 +47,43 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); my $kohaVersion = C4::Context->preference("Version"); +# restore ., for display consistency +$kohaVersion =~ /(.)\.(..)(..)(...)/; +$kohaVersion = "$1.$2.$3.$4"; # the $kohaVersion is duplicated since 3.7: the 3.6 (that uses the old mechanism) and the 3.7 (new mechanism). # Both versions reflects how the database has been upgraded my $already_knows = C4::Update::Database::list_versions_already_knows(); +# $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 +my $last_known=0; +# $last_known_sep contains the previous DBrev applied with the separator (used for display) +my $last_known_sep=""; for my $v ( @$already_knows ) { + my $current = $v->{version}; + $current =~s/\.//g; + # if the current number is the previous one +1, then just add a ., for a better display N.........N+10, for example + # (instead of N / N+1 / N+2 / ...) + if ($current==$last_known+1) { + $kohaVersion.="."; + } else { # we're not N+1, start a new range + # if version don't end by a ., no need to add the current loop number + # this avoid having N...N (in case of an isolated BDrev number) + if ($last_known & $kohaVersion =~ /\.$/) { + $kohaVersion .= "...".$last_known_sep; + } + # start a new range $kohaVersion .= " / ".$v->{version}; + } + $last_known= $current; + $last_known_sep=$v->{version}; +} +# add the last DB rev number, we don't want to end with "..." +if ($kohaVersion =~ /\.$/) { + $kohaVersion .= "...".$last_known_sep; } + +# remove any 0 just after a . for better readability (3.06.02.001 will become 3.6.2.1) +$kohaVersion =~ s/\.0+/\./g; + my $osVersion = `uname -a`; my $perl_path = $^X; if ($^O ne 'VMS') { --- a/admin/updatedatabase.pl +++ a/admin/updatedatabase.pl @@ -16,6 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use Modern::Perl; +use strict; use CGI; use C4::Auth; use C4::Output; @@ -92,6 +93,7 @@ if ( $op eq 'list' ) { my @v_availables = map { {version => $$_{version}} } @availables; $template->param( + dev_mode => $ENV{DEBUG}, versions => \@sorted, nb_availables => scalar @availables, availables => [ map { {version => $$_{version}} } @availables ], --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/updatedatabase.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/updatedatabase.tt @@ -37,7 +37,7 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] - +
@@ -45,7 +45,7 @@
-

Update Database

+

Database update

[% IF report_loop %]
Report : @@ -66,7 +66,7 @@ [% END %] [% IF nb_availables %] - [% nb_availables %] versions are availables [ UPDATE ] + [% nb_availables %] update(s) available [ UPDATE ] [% ELSE %] Your database is up to date [% END %] @@ -75,10 +75,10 @@ - + - + @@ -110,7 +110,9 @@
VersionDB revision Comments StatusLaunchAvailability Details
[% IF v.available %] Available + [% IF (dev_mode) %] [Execute] + [% END %] [% ELSE %] Already executed [% END %] --