@@ -, +, @@ Improvement or procure a stopwatch (stopwatch will be simpler but less accurate). lacking patrons to modify in your database you can import 1000 using the PatronDataCSV.csv attachement and the Import Patrons tool before moving to step 3. "1000 patrons will be deleted 0 checkout history will be anonymized" If not please go back to step 2 and import patrons using the PatronDataCSV.csv start counting seconds from the point you click the button in the next step. and check the time or navigate to the folder you have set NYTProf to output. the post-optimisation time. post-optimisation time should be faster. --- C4/Members.pm | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) --- a/C4/Members.pm +++ a/C4/Members.pm @@ -456,9 +456,10 @@ sub GetMember { } } $debug && warn $select, " ",values %information; - my $sth = $dbh->prepare("$select"); + my $sth = $dbh->prepare_cached("$select"); $sth->execute(map{$information{$_}} keys %information); my $data = $sth->fetchall_arrayref({}); + $sth->finish; #FIXME interface to this routine now allows generation of a result set #so whole array should be returned but bowhere in the current code expects this if (@{$data} ) { @@ -1771,17 +1772,36 @@ The routine returns 1 for success, undef for failure. =cut sub MoveMemberToDeleted { - my ($member) = shift or return; - - my $schema = Koha::Database->new()->schema(); - my $borrowers_rs = $schema->resultset('Borrower'); - $borrowers_rs->result_class('DBIx::Class::ResultClass::HashRefInflator'); - my $borrower = $borrowers_rs->find($member); - return unless $borrower; + my ($borrowernumber) = shift or return; + my $dbh = C4::Context->dbh; + my $borrower_columns = q{ + title, surname, firstname, dateofbirth, initials, + othernames, sex, relationship, guarantorid, streetnumber, + streettype, address, address2, city, state, zipcode, + country, phone, phonepro, mobile, email, emailpro, fax, + B_streetnumber, B_streettype, B_address, B_address2, + B_city, B_state, B_zipcode, B_country, B_phone, B_email, + contactnote, altcontactfirstname, altcontactsurname, + altcontactaddress1, altcontactaddress2, altcontactaddress3, + contactname, contactfirstname, contacttitle, altcontactstate, + altcontactzipcode, altcontactcountry, altcontactphone, + cardnumber, branchcode, categorycode, sort1, sort2, + dateenrolled, dateexpiry, opacnote, borrowernotes, userid, + password, flags, gonenoaddress, lost, debarred, + debarredcomment, smsalertnumber, privacy + }; - my $deleted = $schema->resultset('Deletedborrower')->create($borrower); + my $insert_query = " + INSERT INTO deletedborrowers + ($borrower_columns) + SELECT $borrower_columns + FROM borrowers + WHERE borrowernumber = ? + "; - return $deleted ? 1 : undef; + my $sth = $dbh->prepare($insert_query); + my $result = $sth->execute($borrowernumber); + return $result ? 1 : undef; } =head2 DelMember --