Skip to content

Commit 9d3498f

Browse files
committed
avoid upgrade taking too long where there are a lot of subscribers.
1 parent eeee75a commit 9d3498f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

public_html/lists/admin/upgrade.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,14 +586,25 @@ function output($message)
586586
// add uuids to those that do not have it
587587
$req = Sql_Query(sprintf('select id from %s where uuid = ""', $GLOBALS['tables']['user']));
588588
$numS = Sql_Affected_Rows();
589-
if ($numS > 10000) {
589+
if ($numS > 500) {
590+
591+
// with a lot of subscrirbers this can take a very long time, causing a blank page for a long time (I had one system where it took almost an hour)
592+
//.This really needs to be loaded in Async mode, therefore I'm removing this for now
593+
// it is not strictly necessary to do this here, because processqueue does it as well.
594+
// that does mean that the first process queue may take a while.
595+
596+
// output(s('Giving a UUID to your subscribers and campaigns. If you have a lot of them, this may take a while.'));
597+
// output(s('If the page times out, you can reload. Or otherwise try to run the upgrade from commandline instead.').' '.resourceLink('https://resources.phplist.com/system/commandline', s('Documentation how to set up phpList commandline')));
598+
} else {
590599
output(s('Giving a UUID to your subscribers and campaigns. If you have a lot of them, this may take a while.'));
591600
output(s('If the page times out, you can reload. Or otherwise try to run the upgrade from commandline instead.').' '.resourceLink('https://resources.phplist.com/system/commandline', s('Documentation how to set up phpList commandline')));
601+
while ($row = Sql_Fetch_Row($req)) {
602+
Sql_Query(sprintf('update %s set uuid = "%s" where id = %d', $GLOBALS['tables']['user'], (string)uuid::generate(4), $row[0]));
603+
}
592604
}
593605

594-
while ($row = Sql_Fetch_Row($req)) {
595-
Sql_Query(sprintf('update %s set uuid = "%s" where id = %d', $GLOBALS['tables']['user'], (string) uuid::generate(4), $row[0]));
596-
}
606+
// let's hope there aren't too many campaigns or links, otherwise the same timeout would apply.
607+
597608
$req = Sql_Query(sprintf('select id from %s where uuid = ""', $GLOBALS['tables']['message']));
598609
while ($row = Sql_Fetch_Row($req)) {
599610
Sql_Query(sprintf('update %s set uuid = "%s" where id = %d', $GLOBALS['tables']['message'], (string) uuid::generate(4), $row[0]));

0 commit comments

Comments
 (0)