This ticket goal is to fix the installer in the use case of reinstalling over the same DB and reusing Piwik tables, as to not lose any data.
Use case: - Currently running Piwik 2.0.3 - Delete config file - Upload latest Piwik 2.0.4 - Go through install and set the same DB as before. - Click "Reuse existing tables" - Next step create a super user. Click the button, and we get the error: There was an error when adding the Super User: - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'superuser_access' in 'field list'
The reason is that the DB is still in version 2.0.3 and so the new column added in 2.0.4-b3 is not yet in the DB.
As soon as "reuse tables" during the installation, we should run the Updater process (in the background), and report any error that may have occured during the update, as part of the installation process. If it was successful, maybe we write the message "The database was successfully updated from 2.0 to 2.0.4!"
Maybe in this case we could rename step 5 from "Creating the Tables" to "Reusing the Tables".
In d0e5faa1301164e88bb89e4681e604a2e6e659b7: refs #4631 started to work on installing updates during installation in case we reuse existing tables. Problem: In case there are updates available and one of those updates writes a config the installer thinks we are already done. Therefore we do now create the config file as early as possible and before the install the updates. We create the config file once we have the database information. Also allows us to remove the db_infos session hack. While installation is in progress we set a flag in General currently named install_in_progress (tbd)
Nice approach to fixing this!
- When I type in an existing DB + table prefix, I don't get option to reuse tables. Instead it displays the message in red:
Error: it seems you tried to skip a step of the Installation process, or your cookies are disabled, or the Piwik configuration file was already created. Make sure your cookies are enabled and go back to the first page of the installation .
- After this, I go back to first step, click Next twice, and it skips step 3 Database Setup to directly go to Step 5 creating tables.
- Expected: the red message is not displayed and instead the Step 4 / 5 are loaded directly.
- When reusing tables, maybe the Super User should also be reused and the step to create Super user be skipped? Otherwise I was trying to create another Super user called "root" and got the error " There was an error when adding the Super User: - Login 'root' already exists. "
- Maybe still we could be nice to the user and tell him what the current Super User login is, in case he forgot the username. if he wants to change the password he can do it after the installer.
- Selecting "About Piwik translations" in the language selector brings the red error message
In e2d3362e24b99abe2da3dd5c779ccb015bd85810: refs #4631 it is now possible to update from 1.0 to 2.0.4 during installation
In 5409adef12e0173f966eccfd1f8d07e85c366f67: refs #4631 added translation and success icon for consistency, make sure the remove the install_in_progress key after successful installation
In 3698d416448590e33994eadc8d1458d351124af8: refs #4631 do no longer reuse existing db info if they are already present during installation. This was not working before and removed it again after it is not that easy and not really doable with the current installer.
In 3ccf74d2c63411a66f78a1e14161b964b2e94130: refs #4631 tweaking the output in case of an error during the update
In e996f0355632696332d0641f6bd54f5d8f8a3b05: refs #4631 update menu title as long as we are on the reuse table page
In 5bb441b2e3fba9d067430eac829bce46ac8caa03: refs #4631 updates key whether translation is in progress
Done and should work. I've tested loads of different possibilities. Hope did not miss a special use case...