View | Details | Raw Unified | Return to bug 33297
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_33297.pl (-12 / +18 lines)
Lines 6-25 return { Link Here
6
    up => sub {
6
    up => sub {
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Correct preference may have been generated via interface
9
        my ($wrong_syspref_exists) = $dbh->selectrow_array(q{
10
        my ($correct_syspref_exists) = $dbh->selectrow_array(q{
10
            SELECT COUNT(*) FROM systempreferences WHERE variable='RetainPatronSearchTerms'
11
            SELECT COUNT(*) FROM systempreferences WHERE variable='RetainPatronsSearchTerms'
12
        });
11
        });
13
        if ($correct_syspref_exists) {
12
        if ($wrong_syspref_exists) {
14
            $dbh->do(q{
13
            # Correct preference may have been generated via interface
15
                DELETE FROM systempreferences WHERE variable='RetainPatronSearchTerms'
14
            my ($correct_syspref_exists) = $dbh->selectrow_array(q{
15
                SELECT COUNT(*) FROM systempreferences WHERE variable='RetainPatronsSearchTerms'
16
            });
16
            });
17
            say $out "Wrong system preference 'RetainPatronSearchTerms' deleted";
17
            if ( $correct_syspref_exists ) {
18
                $dbh->do(q{
19
                    DELETE FROM systempreferences WHERE variable='RetainPatronSearchTerms'
20
                });
21
                say $out "Wrong system preference 'RetainPatronSearchTerms' deleted";
22
            } else {
23
                $dbh->do(q{
24
                    UPDATE systempreferences SET variable='RetainPatronsSearchTerms' WHERE variable='RetainPatronSearchTerms'
25
                });
26
                say $out "Wrong system preference 'RetainPatronSearchTerms' renamed 'RetainPatronsSearchTerms'";
27
            }
18
        } else {
28
        } else {
19
            $dbh->do(q{
29
            say $out "Wrong system preference 'RetainPatronSearchTerms' does not exist";
20
                UPDATE systempreferences SET variable='RetainPatronsSearchTerms' WHERE variable='RetainPatronSearchTerms'
21
            });
22
            say $out "Wrong system preference 'RetainPatronSearchTerms' renamed 'RetainPatronsSearchTerms'";
23
        }
30
        }
24
    },
31
    },
25
};
32
};
26
- 

Return to bug 33297