OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



How to apply a patch to OJS

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

How to apply a patch to OJS

Postby levidad » Mon Nov 17, 2008 4:23 am

Hi, folks

After having some problems with creation of a new section, I've been helped, and told to apply the patches available at
http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=3790

But I don't know how to apply those patches, since they are only text files.
Please, help.

Thanx in advance.
levidad
 
Posts: 6
Joined: Fri Nov 14, 2008 6:55 am

Re: How to apply a patch to OJS

Postby levidad » Mon Nov 17, 2008 4:57 am

Ok, so I found this tool, for applying patches in a windows enviroment.
http://www.gnu.org/software/patch/patch.html

Now I'm just learning how to use it.
levidad
 
Posts: 6
Joined: Fri Nov 14, 2008 6:55 am

Re: How to apply a patch to OJS

Postby levidad » Mon Nov 17, 2008 6:08 am

Ok, I got it.

In Windows:
To apply a patch to you OJS, just follow the link for the given patch. You should see a page containing pure text. This represents a diff file (I think) and it tells what lines of code in the original file should be deleted and which ones should be added.

Copy and paste this text in a black document in your notepad, then save it to the root of your OJS system (e.g. c:\Inetpub\wwwroot\ojs\) as anyName.patch.
Download the tool I mentioned in the above post, and place it in the root of your OJS system as well.

Then, enter the command prompt and reach the root of your OJS system.
From there, type this to apply the patch:
patch -p0 < anyName.patch
or type this to remove the patch:
patch -p0 -R < anyName.patch

If you have doubts, PM me, or post it here.

-----

Edit: you can get the patch tool directly from here:
http://sourceforge.net/project/download ... irror=ufpr
levidad
 
Posts: 6
Joined: Fri Nov 14, 2008 6:55 am

Re: How to apply a patch to OJS

Postby jmacgreg » Mon Nov 17, 2008 12:24 pm

Hi Levidad,

Many thanks for the detailed instructions on applying patches in a Windows environment! Would you mind if I moved this into the OJS Discussion forum and marked it as a sticky how-to? I think this thread could be of great use to others.

Cheers,
James
jmacgreg
 
Posts: 4162
Joined: Tue Feb 14, 2006 10:50 am

Re: How to apply a patch to OJS

Postby michael » Thu Feb 18, 2010 9:42 am

One recent addition to this how-to: the PKP team has recently changed version control systems and now uses Git instead of CVS.

The default patches generated via Git are similar to those via CVS, but there is a small difference in how they need to be applied.

For CVS, the general method is:

Code: Select all
patch -p0 < anyName.patch


For Git patches, this will need to be changed to:

Code: Select all
patch -p1 < anyName.patch


Note the difference between -p0 and -p1. This tells the patch utility to remove either 0 or 1 directory from the start of patch file paths.

For example, if you look at the contents of a CVS-generated patch, the file paths will typically look like this:
Code: Select all
locale/en_US/locale.xml


If you look at a Git-generated patch, the file paths will typically look like this:
Code: Select all
a/locale/en_US/locale.xml


The -p1 tells patch to remove the 'a/' at the start of the path, resulting in locale/en_US/locale.xml, a file that patch will be able to locate if you run it in your OJS install dir.

Older patches generated via CVS need to be applied via the first method posted in this thread.

Newer patches generated via Git need to be applied via the second method.
michael
 
Posts: 403
Joined: Thu Mar 29, 2007 2:09 pm

Re: How to apply a patch to OJS

Postby michael » Fri Feb 19, 2010 6:01 pm

If your hosting provider does not give you command line access to your server to apply patches directly, there are two additional methods for upgrading your server.

1) Keep a mirror copy of your server files on your PC, patch them on your PC, and then FTP/upload the patched files to your server.

2) Download copies of the entire, patched files from Git and then FTP/upload these to your server:

The following directions assume OJS, please replace with OCS, OMP, etc. for other PKP apps.

  • Go to http://www.github.com/pkp/ojs
  • Click on 'Commits'
  • From the 'Branches' drop-down list, select 'master' for OJS 2.3.x or 'stable' for OJS 2.2.x
  • In the commit history for the branch, locate and click on the link for the bug of interest (e.g. *4857* Added batch merge option). This is a commit point for the branch that fixes the bug.
  • The commit point page will include a full listing of all of the files that were modified to fix the bug. Each modified file will include a separate link (the file's full path, e.g. locale/en_US/admin.xml) that can be opened separately, for example, in a new browser tab, to display the file's contents.
  • In the file contents page, you can either copy-and-paste the file contents or click on the 'raw' link on the right-hand side to display the file as raw text and then use 'Save as ...' to save the file to your PC.
  • Each saved file can then be FTP/uploaded to your server.
michael
 
Posts: 403
Joined: Thu Mar 29, 2007 2:09 pm

Re: How to apply a patch to OJS

Postby nevermind182004 » Fri Mar 05, 2010 2:11 am

levidad wrote:Ok, so I found this tool, for applying patches in a windows enviroment.
http://www.gnu.org/software/patch/patch.html

Now I'm just learning how to use it.


hello, its my first time applying patches on our ojs.. my current version is 2.2.2 and i wanted to upgrade to 2.2.4.. I'm a lil bit confuse on where will i input the text patches.. the link provided by levidad is gone, so im a bit lost in here.. his explanation is quite understandable but im really stuck on that tools he used.. can some1 help me provide a link to that tool he was using? or any other command line tools provided by another steps on how to patch it? thanks.

patch -p0 < anyName.patch
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: How to apply a patch to OJS

Postby nevermind182004 » Sun Mar 07, 2010 10:32 pm

hello. i need help please thanks :(
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: How to apply a patch to OJS

Postby michael » Mon Mar 08, 2010 1:24 pm

Hi nevermind182004,

Try one of the download links on this page:
http://gnuwin32.sourceforge.net/packages/patch.htm

Cheers,
Michael
michael
 
Posts: 403
Joined: Thu Mar 29, 2007 2:09 pm

Re: How to apply a patch to OJS

Postby nevermind182004 » Mon Mar 08, 2010 6:11 pm

Hi Michael,

Thanks for the reply. i have downloaded it but i dont know how to use it? sorry but im really new on this and i really need help on it on my future upgrades.. :)

but anyway, i have updated my previous version of ojs. here's what i did, i donwloaded a new installer of OJS 2.2.4 then in the installation, there is a selection whether i wanna upgrade from my old OJS version. Then, that's it, he just located my database ojs@localhost then update. I was doing this on my local drive.

My question is, if my site is already online, on my hosting provider, can i just get the database of it, and upgrade it on my localhost then post it back to my hosting provider? Again thanks for the help sir michael :)

Regards,
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm

Re: How to apply a patch to OJS

Postby michael » Wed Mar 10, 2010 1:22 pm

nevermind182004 wrote:My question is, if my site is already online, on my hosting provider, can i just get the database of it, and upgrade it on my localhost then post it back to my hosting provider? Again thanks for the help sir michael :)


Yes, if you temporarily disable your site for the duration of the upgrade.

No, if you cannot disable your site or if it needs to be online 24/7.

The reason that you need to disable your site is that during the time that you're upgrading your database on your local PC, users will be accessing your site, submitting articles, completing reviews, etc. When you upload your upgraded database from your local PC to replace the old database on your server you'll overwrite and lose this user activity and the information that was added to your server database during this time.

Hope that helps.

Michael
michael
 
Posts: 403
Joined: Thu Mar 29, 2007 2:09 pm

Re: How to apply a patch to OJS

Postby nevermind182004 » Wed Mar 10, 2010 6:21 pm

Hello,

Many thanks Sir Michael! however upon updating the database, error occurs in the Editors role: https://pkp.sfu.ca/support/forum/viewto ... f=8&t=5023 but anyway, this goes on a different topic. thanks again for the help :)
nevermind182004
 
Posts: 86
Joined: Mon Apr 20, 2009 6:02 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Majestic-12 [Bot] and 4 guests