WordPress Manual Upgrade for Experts: Difference between revisions

mNo edit summary
 
(14 intermediate revisions by the same user not shown)
Line 8: Line 8:


===Website Files===
===Website Files===
Move the website files to another version (no need to copy, you'll see just below);<syntaxhighlight lang="text">
Move the website files to another version (no need to copy, you'll understand, explained below);<syntaxhighlight lang="text">
mv WebSiteDirectory WebSiteDirectory.WorkingVersionX.Y.Z
mv WebSiteDirectory WebSiteDirectory.WorkingVersionX.Y.Z


Line 19: Line 19:


The WebSiteDirectory will need to be erased before copying the new updated WordPress files.
The WebSiteDirectory will need to be erased before copying the new updated WordPress files.
-a = -dpR = Preserve Symbolic Links and Recursive
-x = Exclude mount points, and thankfully this switch applies to several commands so it isn't documented in the MAN page for cp.
</syntaxhighlight>
</syntaxhighlight>
When testing the functionality of the site, it should be completely functional since the above command copies all files and directories (sub-directories too), retains permissions, retains symbolic links, IE makes an ''exact'' duplicate.  If you do choose to make a copy, you'll need to delete it or move it so the original directory name can be used for the upgrade files.
When testing the functionality of the site, it should be completely functional since the above command copies all files and directories (sub-directories too), retains permissions, retains symbolic links, IE makes an ''exact'' duplicate.  If you do choose to make a copy, you'll need to delete it or move it so the original directory name can be used for the upgrade files.
Line 24: Line 26:
===Database===
===Database===
For the database, use the mySQL (MariaDB, etc.) command line or phpMyAdmin.  phpMyAdmin makes it much easier.  Select the database in the left pane, Export Tab, "Simple" Radio Button, Go Button, save it to a file, done.
For the database, use the mySQL (MariaDB, etc.) command line or phpMyAdmin.  phpMyAdmin makes it much easier.  Select the database in the left pane, Export Tab, "Simple" Radio Button, Go Button, save it to a file, done.
For the command line;
* Export: mysqldump -u WhatEverUserName -p <mark>WhatEverDataBaseName</mark> > WhatEverFileName<mark>.sql</mark>
* Create
** CREATE DATABASE WhatEverDatabaseName;
** GRANT ALL ON WhatEverDatabaseName.* TO 'WhatEverUserName'@'localhost' IDENTIFIED BY 'WhatEverPassword';
** FLUSH PRIVILEGES;
* Import: mysql -u WhatEverUserName-p WhatEverDatabaseName< <mark>WhatEverFileName.sql</mark>
<br />


===Other Thoughts===
===Other Thoughts===
Line 30: Line 43:
==Upgrade==
==Upgrade==


*Download whichever version of WordPress you need / want: https://wordpress.org/download/releases/
*Download whichever version of WordPress you need / want from here (Minor version upgrades are the safest, IE 4.9.13 to 4.9.16): https://wordpress.org/download/releases/
*Extract the files (if downloading a TAR version);
*Extract the files (if downloading a TAR version)
*<syntaxhighlight lang="text">
 
tar -xf WhatEverFIleName
AND
 
*Move or copy the ''extracted'' files to a directory of the same name as the ''original'' web server directory (IE, after the above MV command when backing up the WordPress Site, the original Directory containing the site should not exist (or at least be empty)): mv Source Destination
<syntaxhighlight lang="text">
tar -xf WhatEverFileName
mv WhatEverFileName NewFileName (to rename from the default WordPress Directory name)
 
OR
 
tar -xvzf wordpress-w.x.yz.tar.gz -C /var/www/html/WhatEverDirectory (Don't worry about making a mess with a lot of files as the TAR File's first item is a Directory, as it should be)
</syntaxhighlight>
</syntaxhighlight>
*Move or copy the ''extracted'' files to the ''original'' web server directory: mv Source Destination
 
*Set the proper ownership and file permissions on the new files (the below example is for Apache on CentOS);<syntaxhighlight lang="text">
*Set the proper ownership and file permissions on the new files (the below example is for Apache on CentOS)
<syntaxhighlight lang="text">
chown -R apache:apache /var/www/html/WebSiteDirectory  
chown -R apache:apache /var/www/html/WebSiteDirectory  
find /var/www/html/WebSiteDirectory -type d -exec chmod 755 {} \;                       
find /var/www/html/WebSiteDirectory -type d -exec chmod 755 {} \;                       
find /var/www/html/WebSiteDirectory -type f -exec chmod 644 {} \;
find /var/www/html/WebSiteDirectory -type f -exec chmod 644 {} \;
</syntaxhighlight>
</syntaxhighlight>
*Copy the working version of the WordPress website files into the new directory (The below command will not overwrite any of the new files and will also preserve all permissions from the "original / working" WordPress version.  The end result is a directory with upgraded WordPress Files and all of the additional or custom stuff from the original site;<syntaxhighlight lang="text">
 
*Copy the working version of the WordPress website files into the new directory (The below command will not overwrite any of the new files and will also preserve all permissions from the "original / working" WordPress version.  The end result is a directory with upgraded WordPress Files and all of the additional or custom stuff from the original site
<syntaxhighlight lang="text">
cp -R -n -v -a -x /var/www/html/WebSiteDirectory.WorkingVersion/* /var/www/html/WebSiteDirectory
cp -R -n -v -a -x /var/www/html/WebSiteDirectory.WorkingVersion/* /var/www/html/WebSiteDirectory


Line 47: Line 72:
Flags can be combined, IE -Rnvax, but are shown separately for clarity.
Flags can be combined, IE -Rnvax, but are shown separately for clarity.
</syntaxhighlight>
</syntaxhighlight>
*Make sure the wp-config.php file is in the upgrade directory (The "original / working" version of the file should be copied with the above CP command as it does not typically exist in a newly extracted version of WordPress (it's generated))
 
*Also remember a LOT of extensions make use of an .htaccess file (with Apache and other web servers) to modify the behavior of a WordPress site, so make sure that file from the original version of that file is copied into the upgrade directory (its a hidden file, so make sure).
*Make sure the original wp-config.php file is in the upgrade directory (The "original / working" version of the file should be copied with the above CP command as it does not typically exist in a newly extracted version of WordPress (it's generated))
*Also remember a LOT of extensions make use of an .htaccess file (with Apache and other web servers) to modify the behavior of a WordPress site, so '''make sure the .htaccess file from the original version of that file is copied into the upgrade directory''' (it is a hidden file, so double check that).  And after it was promptly forgotten by the author of this article, looked it up and found this reference too: https://tompai.pro/wordpress/solved-404-on-posts-and-pages-after-wordpress-update-to-4-9-8/ (it applies to other versions than the one noted in that article).


===Plugins===
===Plugins===
Line 54: Line 80:
cp -ax WhatEverExtension WhatEverExtension.BackUp
cp -ax WhatEverExtension WhatEverExtension.BackUp
</syntaxhighlight>
</syntaxhighlight>
===Database===
The website database may also need to be updated.  Navigate to: https://www.riseofthesaltonsea.com/wp-admin/upgrade.php and it will prompt to update the database if necessary.


==Final Thoughts==
==Final Thoughts==