WordPress Manual Upgrade for Experts: Difference between revisions

Created page with "There are lots of websites detailing how to manually upgrade a WordPress Site. Most of them seem to be done by people with very little background in Linux or command line usa..."
 
mNo edit summary
Line 7: Line 7:
First of all BACK EVERYTHING UP!!!  Don't take a chance that the upgrade will mess something up, make a backup.  For WordPress, that consists of two items: The website files and the data base.
First of all BACK EVERYTHING UP!!!  Don't take a chance that the upgrade will mess something up, make a backup.  For WordPress, that consists of two items: The website files and the data base.


=== Website Files ===
===Website Files===
Backup the website files (actually make a copy)<syntaxhighlight lang="text">
Backup the website files (actually make a copy)<syntaxhighlight lang="text">
mv WebSiteDirectory WebSiteDirectory.WorkingVersionX.Y.Z
mv WebSiteDirectory WebSiteDirectory.WorkingVersionX.Y.Z
Line 20: Line 20:
</syntaxhighlight>Now test the web site.  It should be completely functional as the above command copies all files and directories (sub too), retains permissions, retains symbolic links, IE makes an ''exact'' duplicate.
</syntaxhighlight>Now test the web site.  It should be completely functional as the above command copies all files and directories (sub too), retains permissions, retains symbolic links, IE makes an ''exact'' duplicate.


=== Database ===
===Database===
For the database, use the command line or phpMyAdmin.  phpMyAdmin makes it really easy.  Select the database, export, simple, Go, save it, done.
For the database, use the command line or phpMyAdmin.  phpMyAdmin makes it really easy.  Select the database, export, simple, Go, save it, done.


=== Other Thoughts ===
===Other Thoughts===
Most of the people that have documented how to do a manual upgrade of WordPress also stress the importance of backing up.  Their methods won't work if the WordPress upgrade hoses the site for some reason.  IE, if one uses a plugin to backup a WordPress site, an upgrade is done which hoses the site, how does one restore a backup with a plugin if the site doesn't work?  Bit of an issue there, so instead why not get down to basics and uses some basic commands as explained here.  The bottom line is that if one is doing some major stuff like an upgrade, don't rely on a plugin to restore things.
Most of the people that have documented how to do a manual upgrade of WordPress also stress the importance of backing up.  Their methods won't work if the WordPress upgrade hoses the site for some reason.  IE, if one uses a plugin to backup a WordPress site, an upgrade is done which hoses the site, how does one restore a backup with a plugin if the site doesn't work?  Bit of an issue there, so instead why not get down to basics and uses some basic commands as explained here.  The bottom line is that if one is doing some major stuff like an upgrade, don't rely on a plugin to restore things.


== Upgrade ==
==Upgrade==


* Download whichever version of WordPress you want: https://wordpress.org/download/releases/
*Download whichever version of WordPress you want: https://wordpress.org/download/releases/
* Extract the files (if downloading a TAR version): tar -xf WhatEverFIleName
*Extract the files (if downloading a TAR version): tar -xf WhatEverFIleName
* Move or copy the files to the web server directory: mv Source Destination
*Move or copy the files to the web server directory: mv Source Destination
* Set the proper ownership and file permissions on the new files (the below example is for CentOS and Apache);<syntaxhighlight lang="text">
*Set the proper ownership and file permissions on the new files (the below example is for CentOS and Apache);<syntaxhighlight lang="text">
chown -R apache:apache /var/www/html/WhatEverDirectory
chown -R apache:apache /var/www/html/WhatEverDirectory
find /var/www/html/WhatEverDirectory -type d -exec chmod 755 {} \;                       
find /var/www/html/WhatEverDirectory -type d -exec chmod 755 {} \;                       
Line 37: Line 37:
</syntaxhighlight><br />
</syntaxhighlight><br />


*Copy the working version of the WordPress website files into the new directory;
*<syntaxhighlight lang="text">
cp -R -n -v -a -x /var/www/html/WorkingWebSite/* /var/www/html/WebSite Note: Flags can be combined, IE -Rnvax, but are shown separately for clarity.
</syntaxhighlight>


* Copy the working version of the WordPress website files into the new directory;
The above command will not overwrite any of the new files and will also preserve all permissions from the "working" WordPress files.  The end result is upgraded WordPress Files and any custom stuff in the same directory.


cp -R -n -v -a -x /var/www/html/WorkingWebSite/* /var/www/html/WebSite
Make sure the wp-config.php file is in the upgrade directory (there shouldn't be a wp-config.php file in the upgrade folder and it should be copied with the above CP command)
Note: Flags can be combined, IE -Rnvax, but are shown separately for clarity.  Also, to just make a duplicate copy of a Directory: cp -ax Source Destination is the best route to go.
This will not overwrite any new files, IE "upgraded" files, but has the effect of copying all the extensions, images, and any other files from the old website version, while paying deference to the newer files.