From b4533dc12fce77271c53b705577991b48b9c4ad7 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 25 May 2023 15:38:53 +0000 Subject: [PATCH] Bug 27378: Update to new atomicupdate structure This patch consolidates the previous 4 database update files into one atomicupdate file in line with the new structure --- .../bug_27378-add_cookie_consents.pl | 22 +++++++++++++++++++ .../bug_27378_add_ConsentJS_syspref.perl | 8 ------- ...ug_27378_add_CookieConsentBar_syspref.perl | 8 ------- ..._27378_add_CookieConsentPopup_syspref.perl | 8 ------- .../bug_27378_add_CookieConsent_syspref.perl | 8 ------- 5 files changed, 22 insertions(+), 32 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_27378-add_cookie_consents.pl delete mode 100644 installer/data/mysql/atomicupdate/bug_27378_add_ConsentJS_syspref.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentBar_syspref.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentPopup_syspref.perl delete mode 100644 installer/data/mysql/atomicupdate/bug_27378_add_CookieConsent_syspref.perl diff --git a/installer/data/mysql/atomicupdate/bug_27378-add_cookie_consents.pl b/installer/data/mysql/atomicupdate/bug_27378-add_cookie_consents.pl new file mode 100644 index 0000000000..00c8bf0967 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_27378-add_cookie_consents.pl @@ -0,0 +1,22 @@ +use Modern::Perl; + +return { + bug_number => "27378", + description => "Adds the sysprefs for cookie consents", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('CookieConsentedJS', '', 'Add Javascript code that will run if cookie consent is provided (e.g. tracking code).', '', 'Free'); | ); + say $out "Added new system preference 'CookieConsentedJS'"; + + $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('CookieConsent', '0', 'Require cookie consent to be displayed', '', 'YesNo'); | ); + say $out "Added new system preference 'CookieConsent'"; + + $dbh->do( q{ INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('CookieConsentBar', '', 'Show the following HTML in the cookie consent bar that is displayed at the bottom of the screen', '70|10', 'Textarea'); } ); + say $out "Added new system preference 'CookieConsentBar'"; + + $dbh->do( q{INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('CookieConsentPopup', '', 'Show the following HTML in the cookie consent popup', '70|10', 'Textarea');} ); + say $out "Added new system preference 'CookieConsentPopup'"; + }, +}; diff --git a/installer/data/mysql/atomicupdate/bug_27378_add_ConsentJS_syspref.perl b/installer/data/mysql/atomicupdate/bug_27378_add_ConsentJS_syspref.perl deleted file mode 100644 index b219ead1e7..0000000000 --- a/installer/data/mysql/atomicupdate/bug_27378_add_ConsentJS_syspref.perl +++ /dev/null @@ -1,8 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('ConsentJS', '', 'Specify Javascript that requires user consent to run (e.g. tracking code)', '', 'Free'); | ); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 27378 - Add ConsentJS syspref)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentBar_syspref.perl b/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentBar_syspref.perl deleted file mode 100644 index c1f2f82cf6..0000000000 --- a/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentBar_syspref.perl +++ /dev/null @@ -1,8 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q{ INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('CookieConsentBar', '', 'Show the following HTML in the cookie consent bar that is displayed at the bottom of the screen', '70|10', 'Textarea'); } ); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 27378 - Add CookieConsentBar syspref)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentPopup_syspref.perl b/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentPopup_syspref.perl deleted file mode 100644 index 0420876959..0000000000 --- a/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsentPopup_syspref.perl +++ /dev/null @@ -1,8 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q{INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('CookieConsentPopup', '', 'Show the following HTML in the cookie consent popup', '70|10', 'Textarea');} ); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 27378 - Add CookieConsentPopup syspref)\n"; -} diff --git a/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsent_syspref.perl b/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsent_syspref.perl deleted file mode 100644 index 3592a64248..0000000000 --- a/installer/data/mysql/atomicupdate/bug_27378_add_CookieConsent_syspref.perl +++ /dev/null @@ -1,8 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('CookieConsent', '0', 'Require cookie consent to be displayed', '', 'YesNo'); | ); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 27378 - Add CookieConsent syspref)\n"; -} -- 2.37.1 (Apple Git-137.1)