20 January, 2016

Patching ownCloud: get your fix NOW

you can also get quickly loading kittens!
Sometimes, there's something broken. Or, there's a feature you want in your ownCloud installation now.

Well, you can have it, if you're willing to put in a little work!

Let me show how it works.

What we want

Say, you just added 3000 holiday pictures to ownCloud. When you load the folder with the images in the web UI, it is very slow as all thumbnails have to be generated and provided to your browser! What if ownCloud could simply generate all of them during, say, tonight?

Awesome ownCloud developer Oparoz has developed code which gives the occ command the ability to run through your ownCloud, either in its entirety or per user account, and generate all thumbnails. But this code hasn't been merged: Oparoz wants to create code tests first before he merges this, to ensure the quality of the code base. Sadly, he hasn't had time to create tests and nobody else has stepped in yet...

How we get it

How to get this code? Github has this cool trick where you can add .patch behind a pull request URL, like this: https://github.com/owncloud/gallery/pull/387.patch.

Patch your ownCloud with it! This is how:

  1. log in to your server
  2. navigate to the Gallery app folder
  3. grab the patch: wget https://github.com/owncloud/gallery/pull/387.patch
  4. test patching: patch -p1 --dry-run < 387.patch
  5. If you get only a checking [filename] you're all good!
  6. If you have errors check if you are on the right ownCloud release (the patch might be for the latest master and not work on the release you have) and see if you are in the right sub folder.
  7. Now run patch -p1 < 387.patch
  8. Go and enjoy your feature...
  9. If you want to undo the change run: patch -p1 -R < 387.patch

NOTES:
  • be careful running random code from github in your ownCloud, just like experimental apps - this is untested by definition.
  • Also, if you go and add all kinds of patches which end up burning down your house and killing your kittens you have only yourself to blame. I gave you a knife, YOU decided to stick it in your eye.
  • Last but not least, if it works (or doesn't) report back, this is called 'testing' and very valuable to us!!! It will help get the code merged sooner.
  • Idea to blog about it came from the ownCloud meetup tonight ;-)