Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: Diff & Patch : Patches/fixes mods/addons  (Read 5171 times)

tuxStyle

  • Newbie
  • *
  • Karma: 0
  • Posts: 14
Diff & Patch : Patches/fixes mods/addons
« on: May 16, 2007, 08:17:54 pm »

i'm wondering ... why you guys don't use patch and diff when you create a mod or fix a bug?
is v. hard to apply all patches by hand.

patch and diff are v. easy to use and if you don't use Linux you can find Widows versions here:
http://gnuwin32.sourceforge.net/packages/diffutils.htm
http://gnuwin32.sourceforge.net/packages/patch.htm

10x

a small example:

first, get diff and patch for windows:
1. unpack: http://www.activestyle.ca/sNews-patch-mod/bin.zip
2. copy the bin directory where you have your snews.php file


to make a Patch:
1. copy the original snews.php to snews.php.dist
2. make a mod, fix a bug, etc :) changing the snews.php
3. make diff file:
Code: [Select]
bin\diff.exe -uN snews.php.dist snews.php > patch.bugFixsnews.php.dist - original snews.php file
snews.php - modified snews.php
patch.bugFix - diff file to be used with patch



to apply a patch:
make sure that you have everything you need (patch & diff)
1. apply patch:
Code: [Select]
bin\patch.exe -p1 snews.php < patch.bugFixSave the following code in a file named patch.rssFix in directory where you have your snews.php file.
Code: [Select]
--- snews.php.dist 2007-05-16 14:30:30.343750000 -0400
+++ snews.php 2007-05-16 14:40:50.531250000 -0400
@@ -704,7 +704,9 @@
  }
  echo $link.'contact/">'.l('contact').'
';
  echo $link.'sitemap/">'.l('sitemap').'
';
- echo $link.'rss/">'.l('rss_feed').'

';
+    echo $link.'rss-articles/">'.l('rss_articles').'
';
+    echo $link.'rss-pages/">'.l('rss_pages').'
';
+    echo $link.'rss-comments/">'.l('rss_comments').'

';
  echo '

'.l('articles').'

';
  $art_query = "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND published = '1'";
  $query = $art_query." AND category = 0 ORDER BY date DESC";
to apply the patch:
Code: [Select]
bin\patch.exe -p1 snews.php < patch.rssFixPS: sorry for my bad english.
Logged

Vinoth

  • Newbie
  • *
  • Karma: 1
  • Posts: 33
Diff & Patch : Patches/fixes mods/addons
« Reply #1 on: May 16, 2007, 11:41:29 pm »

I think this mod can be applied only if the person has access to run commands, i mean shell. I think most of the host do not provide an option.

I hope so i am not wrong.
Logged

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
Diff & Patch : Patches/fixes mods/addons
« Reply #2 on: May 16, 2007, 11:56:16 pm »

Unfortunately, that's correct, Vinoth :rolleyes:
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

Vinoth

  • Newbie
  • *
  • Karma: 1
  • Posts: 33
Diff & Patch : Patches/fixes mods/addons
« Reply #3 on: May 17, 2007, 12:52:34 pm »

Mika is there any other way to apply TinyMCE Editor to sNews apart from this.
Logged

quaffapint

  • Newbie
  • *
  • Karma: 0
  • Posts: 14
Diff & Patch : Patches/fixes mods/addons
« Reply #4 on: May 17, 2007, 01:50:44 pm »

Right - you might not be able to run this on your host, but you could certainly download your snews file to your local computer and run it from there, then re-upload it.  I wouldn't want to patch my production snews file without testing it locally, anyway  :) .
Logged

bramsyuur

  • Hero Member
  • *****
  • Karma: 23
  • Posts: 873
    • http://snews.vietbee.net
Diff & Patch : Patches/fixes mods/addons
« Reply #5 on: May 17, 2007, 01:52:24 pm »

Hey! tuxStyle are talking about how to apply and use a Windoze binaries to run diff and patch programs into your desktop...  ;)
Logged
La comunidad sNews en tu idioma!
Comunidad sNews en Espaņol

tuxStyle

  • Newbie
  • *
  • Karma: 0
  • Posts: 14
Diff & Patch : Patches/fixes mods/addons
« Reply #6 on: May 17, 2007, 03:43:07 pm »

Yes, you can't apply patches directly on your host.
I have shell access on my web server ... but in my first post, you have a link to windows binaries to work on your local computer (windows) and after that, the patched snews.php can be uploaded.

I will try to find interesting mods and make patches.
I'm at work now... and i have some work to do ...

Anyway, i found some interesting patches for 1.5 and if they work on 1.6, i will make patches for 1.6.
Logged

Vinoth

  • Newbie
  • *
  • Karma: 1
  • Posts: 33
Diff & Patch : Patches/fixes mods/addons
« Reply #7 on: May 19, 2007, 12:52:32 pm »

Can anyone patch sNews 1.6 so that i can work on the mods which requires patches. My Host is linux
Logged

alexanderpas

  • Newbie
  • *
  • Karma: 0
  • Posts: 9
Diff & Patch : Patches/fixes mods/addons
« Reply #8 on: May 19, 2007, 10:01:28 pm »

the usual wikipedia liks...

http://en.wikipedia.org/wiki/Diff
http://en.wikipedia.org/wiki/Patch_(Unix)

and i'm already using patch... example http://www.solucija.com/forum/viewtopic.php?id=4519

however, it must be noted, that the forum software does not properly support the pasting op patches in code blocks (It touches code blocks!!!! Bad Software!!!)
Logged