Journal System Upgrade

To upgrade OJS this general process is used. 
I run all the backup processes as my osgeo1 user account in ~/backup/ojs.
== Backup Database ==
Dump ojs database into a sql dump file. Takes about 5 seconds and produces a file that is only a couple megabytes.
 sudo mysqldump ojs > ojs-2.2.0-pre-upgrade-2.3.mysql
== Backup File System ==
Main files are in /var/www/ojs2.
Two folders need to be backed up, the files and htdocs. Only the htdocs files will end up being updated, but they suggest backing up both. 
The files folder will always be larger as all the uploaded abstracts, finals PDFs, etc. are in there - pretty important! It's about 350MB at time of writing. Creating the tgz file takes about 5 minutes and is about 315MB in size.
 sudo tar -czvf ojs-2.2.0-files.tgz /var/www/ojs2/files
Next back up the htdocs folder. Several past versions of OJS are also installed, with htdocs being symlinked to the current version.
Current folder is about 35MB in size. Tar process takes less than a minute and produces a 5MB file.
 sudo tar -czvf ojs-2.2.0-htdocs.tgz /var/www/ojs2/htdocs
== Patch / Update File System ==
Some info on their site is here: UPGRADE - install README
OJS versions are distributed as full distributions but also as patches between versions. Use the patch to do the upgrade when possible so that any local customisations are retained.
* OJS download page
It's important to know what your current version is. That's why the /var/www/ojs2 folders should have the version number in the name. However, if in doubt, check the versions table in the OJS database.
In this example, the patch file used is 2.2.0 to 2.3.0 (dev version):
 cd /var/www/ojs2
 sudo wget http://pkp.sfu.ca/ojs/download/patch/ojs-2.2.0-0_to_2.3.patch.gz
 sudo gunzip ojs-2.2.0-0_to_2.3.patch.gz
 
Now we'll make a copy of the current htdocs folder and apply our patches in the new folder instead. Yes, this is yet another backup copy, but worth maintaining IMHO.
 sudo cp -r htdocs htdocs-2.3.0-dev
 cd /var/www/ojs2/htdocs-2.3.0-dev
 patch --dry-run -p1 < ../ojs-2.2.0-0_to_2.3.patch
Several prompts will ask you about patching files in the cache folder. These are temporary files that can be ignored for now - there are about 20 of them in this example that prompt you. Select the default (not to patch) by pressing enter. Always use the dry-run option to discover any issues before running it for real.
After you've confirmed you are in the right folder and the patch dry-run looks okay then run the full command by removing the --dry-run option:
 sudo patch -p1 < ../ojs-2.2.0-0_to_2.3.patch
If no errors show then you are in luck!
Change the htdocs symlink to point to the newly patched folder.
 cd /var/www/ojs2
 sudo rm htdocs
 sudo ln -s htdocs-2.3.0-dev htdocs 
== Run Upgrade Scripts ==
To update the database you change a setting in the OJS config.inc.php file and access the upgrade page. After the process is run from there, then you must turn the setting back off.
* Edit config.inc.php and change installed = On to installed = Off - this allows us access to the upgrade tools in the site.
Goto the site now: http://www.osgeo.org/ojs
It will redirect you to a page with an option to upgrade. Select this option, then click the button that appears. A success page should appear.
* Edit config.inc.php and change installed = Off back to installed = On
== Test ==
Category:Journal
Category:Infrastructure