basilhendroff / truenas-iocage-wordpress

Script to install WordPress in an iocage jail including MariaDB, the PHP scripting language, Caddy, Redis and phpMyAdmin.
GNU General Public License v3.0
6 stars 6 forks source link

Reinstall option #3

Closed NasKar2 closed 3 years ago

NasKar2 commented 3 years ago

Add option to reinstall to existing data. Must set options DB_ROOT_PASSWORD="" DB_PASSWORD="" in the config file.

NasKar2 commented 3 years ago
  1. I removed the DB passwords from the config file. Original had them there to correctly write them to the /root/wordpress_db_password.txt file. When you do a reinstall of wordpress with the same data the passwords don't change so wordpress_db_password.txt is still correct.
  2. I've test the reinstall and it does work
  3. I changed to reinstall check to look for the presence of the file "${FILES_PATH}/wp-config.php". If that file is there it should be ok to do a resintall. If not they should wipe out the data directory and start from scratch.
basilhendroff commented 3 years ago

Hi NasKar,

Getting closer. I'm beginning to see where you're heading with this. What I'm starting to recognise is that what's lacking is a clear definition of 'reinstall'. I've come to realise that what it means is that the data outside the jail is considered valid, but the jail itself needs to be rebuilt because, for instance, it's been destroyed.

So, in rebuilding the jail, the guiding principle should be that nothing outside the jail is touched. This would mean for instance that, in a reinstall, the code that configures WP should not be executed (it still is in your version), because those files live outside the jail.

I'm going to close this pull request, but work on something based on your ideas. The main reason is, I think you've exposed your db password in one of the commits. You may want to change your db password now.