Scripting A Wordpress Upgrade
Wordpress seems to require ftp or ftps access to automatically upgrade itself. This bothered me as I saw it as a potential security risk and work I would have to put in to setting up a FTPS server I didn’t want. My solution was to upgrade Wordpress manually.
Following the steps in the link above Wordpress was successfully upgraded. The process was not quick and not easy to remember if they are only used periodically. The decision was then easy to build some scripts and directions for upgrading.
The steps need for this process is as follows
- Login into WordPress and disable your plugins.
- Login to your server using ssh.
- Using wget retrieve the latest copy of wordpress. “wget https://downloads.wordpress.org/release/wordpress-4.1.zip”
- unzip the files “unzip wordpress-4.1.zip”
- Backup Wordpress on the server
- Upgrade Wordpress on the server
- Go to your wordpress wp-admin page.
- You may be prompted to upgrade your databae. Go ahead and do so.
- Enable your plugins.
The second file needs to be run in the directory containing the new Wordpress application files. These would be the files you retrieved and extracted in steps 3 and 4.
I placed these two files in the PATH so that I could run them from wherever. Voila! We now have mostly automated the manual upgrade of WordPress.
Below is a terminal capture of what the process would look like for steps 3 through 6 using the scripts. Steps 4 and 5 will produce verbose output which i didn’t capture below.
Terminal window Steps 3-6tags: bash - script - WordPress