[bugzilla-gnome-org-extensions] trace parser: Move initial trace insertion to later stage during checksetup
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] trace parser: Move initial trace insertion to later stage during checksetup
- Date: Thu, 20 Nov 2014 22:28:46 +0000 (UTC)
commit a56460eaef0f85924e5bc0db464db3127c2fa851
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Thu Nov 20 22:36:03 2014 +0100
trace parser: Move initial trace insertion to later stage during checksetup
install_update_db hook should be used only for schema changes, not for
inserting some data. install_before_final checks is suitable for this
purpose.
TraceParser/Extension.pm | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/TraceParser/Extension.pm b/TraceParser/Extension.pm
index 9135663..87b8049 100644
--- a/TraceParser/Extension.pm
+++ b/TraceParser/Extension.pm
@@ -322,21 +322,16 @@ sub db_schema_abstract_schema {
};
}
-sub install_before_final_checks {
- my ($self, $args) = @_;
-
+sub add_traceparser_edit_group {
if (!Bugzilla::Group->new({ name => 'traceparser_edit' })) {
Bugzilla::Group->create({
name => 'traceparser_edit',
description => 'Can edit properties of traces',
isbuggroup => 0 });
}
-
- add_setting('traceparser_show_traces',
- ['on', 'off'], 'off');
}
-sub install_update_db {
+sub insert_traces_if_there_are_none_in_db {
my $dbh = Bugzilla->dbh;
my $has_traces = $dbh->selectrow_array('SELECT 1 FROM trace '
. $dbh->sql_limit('1'));
@@ -381,6 +376,15 @@ sub install_update_db {
$dbh->bz_commit_transaction();
}
+sub install_before_final_checks {
+ my ($self, $args) = @_;
+
+ add_traceparser_edit_group();
+ add_setting('traceparser_show_traces',
+ ['on', 'off'], 'off');
+ insert_traces_if_there_are_none_in_db();
+}
+
sub page_before_template {
my ($self, $args) = @_;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]