I don't know if there are still people reading here.
I have an idea that should be written in a plugin, but I don't have the knowledge to code it.
Right now I'm doing a part manually and a part with a shell script I invoke manually in command line
The manual part :
- create a second database with _dev at the end
- assign the same user to this database
- create a subdomain dev.DOMAINNAME
Those operations should have been done using the CLI Command for IMSCP but they are not available anymore. I'm sure there is a possibility to do this using a button in a plugin.
Then I call a shell script (this is the raw script, no control done, should be added (is the DB Dev available, is the DEV subdomain available, etc...)
- basename=`cat /var/www/virtual/$1/htdocs/wp-config.php | grep DB_NAME | awk -F "'" {'print $4'}`
- devname=$basename"_dev"
- source="'DB_NAME', '$basename'"
- destination="'DB_NAME', '$devname'"
- dbuser=`cat /var/www/virtual/$1/htdocs/wp-config.php | grep DB_USER | cut -d \' -f 4`
- dbpass=`cat /var/www/virtual/$1/htdocs/wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`
- dbhost=`cat /var/www/virtual/$1/htdocs/wp-config.php | grep DB_HOST | cut -d \' -f 4`
- rm -fr /var/www/virtual/$1/dev/htdocs/*
- cp -pr /var/www/virtual/$1/htdocs/* /var/www/virtual/$1/dev/htdocs/
- cp -p /var/www/virtual/$1/htdocs/.htaccess /var/www/virtual/$1/dev/htdocs/
- sed -i -e "s/$source/$destination/g" /var/www/virtual/$1/dev/htdocs/wp-config.php
- mysqldump -h $dbhost -u $dbuser -p$dbpass $basename | mysql -h $dbhost -u $dbuser -p$dbpass $devname;
- echo "site#dev.$1#http://dev.$1#file#/var/www/virtual/$1/dev/htdocs" >> /root/.wordshell/rc
- echo "siteopt#dev.$1#--justwp" >> /root/.wordshell/rc
- wordshell dev.$1 --database --searchandreplace=http://$1^http://dev.$1
The 13th and 14th line just add the site to my wordshell list of sites and the 15th make a search and replace in the database to change all the url link to the dev site.
I'm sure a lot of people hosts Wordpress sites.
It's really interesting to have this feature before doing some change to a website, to have an instant clone of the website to be able to work on the dev stage.
After the changes made, I don't know what's the best way to do.
Either perform the same push from dev to prod (risk : there are some changes in prod between your dump and you GoToLive)
Either you know those changes are ok, you can do the same in prod (risk : you don't make the change the exact same manner and you fail)
So I think it could be an interesting plugin.
Cedric