Bugzilla – Attachment 174405 Details for
Bug 36039
The output of audit_database.pl should be accessible through the UI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36039: (follow-up) Move view logic to script/template
Bug-36039-follow-up-Move-view-logic-to-scripttempl.patch (text/plain), 7.82 KB, created by
Pedro Amorim
on 2024-11-12 11:56:30 UTC
(
hide
)
Description:
Bug 36039: (follow-up) Move view logic to script/template
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-11-12 11:56:30 UTC
Size:
7.82 KB
patch
obsolete
>From e0de92facf258598c21f0a1f48edb35970cf5b08 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 3 May 2024 10:09:58 +0100 >Subject: [PATCH] Bug 36039: (follow-up) Move view logic to script/template > >This patch updates the module as suggested by David to handle just the >diff code and leaves the display logic up to the templates and script. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: JesseM <jesse@bywatersolutions.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Database/Auditor.pm | 27 ++------------- > about.pl | 4 +-- > .../intranet-tmpl/prog/en/modules/about.tt | 34 ++++++++++++------- > misc/maintenance/audit_database.pl | 10 +++++- > 4 files changed, 34 insertions(+), 41 deletions(-) > >diff --git a/Koha/Database/Auditor.pm b/Koha/Database/Auditor.pm >index 520387bccc..ff0dc8533f 100644 >--- a/Koha/Database/Auditor.pm >+++ b/Koha/Database/Auditor.pm >@@ -44,15 +44,12 @@ sub new { > my ( $class, $params ) = @_; > my $self = bless $params // {}, $class; > $self->{filename} = $params->{filename} // './installer/data/mysql/kohastructure.sql'; >- $self->{is_cli} = $params->{is_cli}; > return $self; > } > > =head3 run > >-Run the database audit with the given arguments, including the filename >- and whether it is a command-line interface(CLI). >-Returns $diff only if $is_cli is false. Else it just prints $diff. >+Run the database audit with the given arguments, including the filename. > > =cut > >@@ -60,9 +57,6 @@ sub run { > my ( $self, $args ) = @_; > > if ( !-f $self->{filename} ) { >- unless ( $self->{is_cli} ) { >- return 'Database schema file not found'; >- } > die("Filename '$self->{filename}' does not exist\n"); > } > >@@ -78,27 +72,10 @@ sub run { > } > )->compute_differences->produce_diff_sql; > >- return $diff unless $self->{is_cli}; >- print $diff . $self->get_warning; >+ return $diff; > } > } > >-=head3 get_warning >- >-Retrieve a warning message. >- >-=cut >- >-sub get_warning { >- my ($self) = @_; >- >- return >- "\n" >- . "WARNING!!!\n" >- . "These commands are only suggestions! They are not a replacement for updatedatabase.pl!\n" >- . "Review the database, updatedatabase.pl, and kohastructure.sql before making any changes!\n" . "\n"; >-} >- > =head3 _get_db > > Retrieves the database schema, removes auto-increment from the schema, and returns the modified schema. >diff --git a/about.pl b/about.pl >index de73993324..2d9419fd45 100755 >--- a/about.pl >+++ b/about.pl >@@ -928,8 +928,8 @@ sub message_broker_check { > > if ( $tab eq 'database' ) { > use Koha::Database::Auditor; >- my $db_auditor = Koha::Database::Auditor->new( { is_cli => 0 } ); >+ my $db_auditor = Koha::Database::Auditor->new(); > my $audit_diff = $db_auditor->run; >- $template->param( audit_diff => $audit_diff, audit_warning => $db_auditor->get_warning ); >+ $template->param( audit_diff => $audit_diff ); > } > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 2fb1c40c34..a1196f1952 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -36,24 +36,24 @@ > [% WRAPPER tab_item linktab = 1 tabname = "about" bt_active = tab == "about" %] <span>Server information</span> [% END %] > [% WRAPPER tab_item linktab = 1 tabname = "perl" bt_active = tab == "perl" %] <span>Perl modules</span> [% END %] > [% WRAPPER tab_item linktab = 1 tabname = "sysinfo" bt_active = tab == "sysinfo" %] <span>System information</span> [% END %] >+ [% WRAPPER tab_item linktab = 1 tabname = "database" bt_active = tab == "database" %] <span>Database audit</span> [% END %] > [% WRAPPER tab_item linktab = 1 tabname = "team" bt_active = tab == "team" %] <span>Koha team</span> [% END %] > [% WRAPPER tab_item linktab = 1 tabname = "licenses" bt_active = tab == "licenses" %] <span>Licenses</span> [% END %] > [% WRAPPER tab_item linktab = 1 tabname = "translations" bt_active = tab == "translations" %] <span>Translations</span> [% END %] > [% WRAPPER tab_item linktab = 1 tabname = "history" bt_active = tab == "history" %] <span>Timeline</span> [% END %] > [% WRAPPER tab_item linktab = 1 tabname = "dedications" bt_active = tab == "dedications" %] <span>Dedications</span> [% END %] >- [% WRAPPER tab_item linktab = 1 tabname = "database" bt_active = tab == "database" %] <span>Database audit</span> [% END %] > [% END %] > [% WRAPPER tab_panels %] > [% SWITCH tab %] > [% CASE 'about' %] [% PROCESS about_panel %] > [% CASE 'perl' %] [% PROCESS perl_panel %] > [% CASE 'sysinfo' %] [% PROCESS sysinfo_panel %] >+ [% CASE 'database' %] [% PROCESS database_panel %] > [% CASE 'team' %] [% PROCESS team_panel %] > [% CASE 'licenses' %] [% PROCESS licenses_panel %] > [% CASE 'translations' %] [% PROCESS translations_panel %] > [% CASE 'history' %] [% PROCESS history_panel %] > [% CASE 'dedications' %] [% PROCESS dedications_panel %] >- [% CASE 'database' %] [% PROCESS database_panel %] > [% CASE %] [% PROCESS about_panel %] > [% END %] > [% END %] >@@ -795,6 +795,25 @@ > [% END # tab=sysinfo %] > [% END %] > >+[% BLOCK database_panel %] >+ [% WRAPPER tab_panel tabname= "database" bt_active = 1 %] >+ <h2>Database audit</h2> >+ <div class="alert alert-warning"> >+ <h3>WARNING!!!</h3> >+ <p> >+ These commands are only suggestions! They are not a replacement for updatedatabase.pl!<br /> >+ Review the database, updatedatabase.pl, and kohastructure.sql before making any changes!<br /> >+ </p> >+ </div> >+ <div> >+ <p>Run the following SQL to fix the database:</p> >+ <pre> >+ <code>[% audit_diff | $raw %]</code> >+ </pre> >+ </div> >+ [% END # tab=database %] >+[% END %] >+ > [% BLOCK team_panel %] > [% WRAPPER tab_panel tabname= "team" bt_active = 1 %] > <h2>Special thanks to the following organizations</h2> >@@ -1357,14 +1376,3 @@ > </p> > [% END # tab=dedications %] > [% END %] >- >-[% BLOCK database_panel %] >- [% WRAPPER tab_panel tabname= "database" bt_active = 1 %] >- <h2>Database audit</h2> >- <p>Run the following SQL to fix the database:</p> >- <code> >- [% audit_diff | html %] >- </code> >- <p class="alert alert-warning">[% audit_warning | html %]</p> >- [% END # tab=database %] >-[% END %] >\ No newline at end of file >diff --git a/misc/maintenance/audit_database.pl b/misc/maintenance/audit_database.pl >index cd624305c3..2d821b692a 100755 >--- a/misc/maintenance/audit_database.pl >+++ b/misc/maintenance/audit_database.pl >@@ -11,4 +11,12 @@ GetOptions( > "filename=s" => \$filename, > ) or die("Error in command line arguments\n"); > >-Koha::Database::Auditor->new( { filename => $filename, is_cli => 1 } )->run; >+my $auditor = Koha::Database::Auditor->new( { filename => $filename } ); >+my $diff = $auditor->run; >+ >+my $warning = "\n" >+ . "WARNING!!!\n" >+ . "These commands are only suggestions! They are not a replacement for updatedatabase.pl!\n" >+ . "Review the database, updatedatabase.pl, and kohastructure.sql before making any changes!\n" . "\n"; >+ >+print $diff . $warning; >-- >2.39.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 36039
:
161892
|
162462
|
162463
|
166097
|
166098
|
166099
|
166155
|
166156
|
166157
|
169225
|
169226
|
169227
|
174403
|
174404
| 174405