The sql there does not make sense to me. Should there be a WHERE clause there? I think it is now looping through the result and each time updating the user_group_id column for the whole authors table?
To be on the safe side, I changed that line to: if ($authorGroup) $userGroupDao->update('UPDATE authors SET user_group_id = ? WHERE author_id = ?', array((int) $authorGroup->getId(), $row['author_id']));
That is probably how it was intended. The result was that the function finishes almost instantly whereas the old query took for hours.
Thanks – your proposed fix is correct. I’ve committed it at the github entry above (both ojs-stable-3_1_0 and master). Glad to hear it also improves performance.
Regards,
Alec Smecher
Public Knowledge Project Team
Thanks @asmecher, I added one more comment to the issue, because I think that potentially journals upgrading with the version available at the PKP website will loose some metadata which can not be fixed later. I could be wrong.