The current workflow for core:archive is to check if there are visits for a site, then launching archiving w/ lastN days/weeks/months/years. The new workflow is: invalidate archive, run core:archive and let it process the queue.
- Archive invalidation now creates archive rows w/ NULL ts_archived if there isn't an existing archive to set the done value for. This allows core:archive to notice and process the archive, even though one never existed beforehand.
- core:archive now selects the next invalidated archive from the archive tables and marks it as in progress so we don't have to look for commands that are already running to know if an archive is being processed.
- there are some bug fixes to the archive invalidation code here, some archives were not invalidated that should be, and some archives were invalidated that did not need to be.
- there is an optimization in Loader.php that vastly improves the performance for archiving sites with no visits (as demonstration, all the system test jobs are much faster now; the one w/ ArchiveCronTest eg has improved from 21 mins to 6 mins).