Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-26 21:57:09

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

rvm_plugin_diff (v0.2)

Have you ever edited any of the plugins you have installed? If so, then rvm_plugin_diff is meant for you.

This plugin helps you do the following:
  • Find the changes you made (color diff, inspired by dev.textpattern.com).
  • Download the changes in unified diff format (a patch which can be sent to the plugin developer).
  • View the plugin code with line numbers at the beginning of each line, so you can find errors easier.

Download

The goal of this plugin is to make it easier to feed back bugfixes to the original authors of plugins. It’s often easy to fix a bug, but I found it hard to find what exactly I had changed afterwards (having edited around half the plugins in use at textpattern.org), so I had some fun writing this plugin and learned a lot about how (unified) diff and patch works.

Note: the patches this plugin creates, use UNIX-style line endings. If the original code was developed on a different platform, you may have to convert the line endings before applying the patch.

  • version 0.1 (2006-11-26)
  • version 0.2 (2006-11-29)
    • fix infinite loop in rare situations (which turn out to be not so rare)
    • separate modified and original plugins in the select list

Last edited by ruud (2006-11-29 00:23:37)

Offline

#2 2006-11-26 23:59:19

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: rvm_plugin_diff (v0.2)

awesome work! I just installed it and am beginning to play around with it.

Offline

#3 2006-11-28 19:37:25

aba
Plugin Author
Registered: 2004-04-14
Posts: 119

Re: rvm_plugin_diff (v0.2)

textpattern shows me wich plugins were changed in the pluginlist – would it be possible to use this info in your plugin as well, e.g. by displaying the plugins that got changed in bold? Agreed, it’s only a minor visual change and maybe not worth the hassle, but still I would it consider a nice touch…

apart from that: nifty and very helpful plugin
Thank you for writing it.

Offline

#4 2006-11-29 00:23:05

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_plugin_diff (v0.2)

aba, instead of making the modified plugins bold, I’ve separated modified and original plugins in the select list. Is that clear enough, you think?
Note that simply saving a plugin without changing it is often enough to make it show up as modified (due to invisible changes in whitespace and line endings).

Offline

#5 2006-11-30 06:00:14

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: rvm_plugin_diff (v0.2)

Ruud

very useful. Thank you!


Steve

Offline

#6 2006-11-30 21:24:42

aba
Plugin Author
Registered: 2004-04-14
Posts: 119

Re: rvm_plugin_diff (v0.2)

great and very helpful. Thank you very very much.

Offline

#7 2006-12-01 03:22:44

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: rvm_plugin_diff (v0.2)

Wow!
Thanks for this plug-in
I have installed it. I don’t know if I will really use it but it makes me feel like a kid enjoying a magic trick!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2008-03-14 10:14:04

candyman
Member
From: Italy
Registered: 2006-08-08
Posts: 684

Re: rvm_plugin_diff (v0.2)

Is the rvm_plugin_diff (v0.2) compatible with TXP 4.0.6?

I’ve installed it but it seems isn’t working.

EDIT: it works, it was my fault.

Last edited by candyman (2008-03-14 10:24:29)

Offline

#9 2017-01-26 17:01:13

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: rvm_plugin_diff (v0.2)

Yo, dawg, I heard you like diffs, so I’ve modified rvm_plugin_diff to show you a diff of the modified rvm_plugin_diff so you can see how the code differs so to make it work on TXP 4.6.x.

--- rvm_plugin_diff-0.2.orig 2017-01-26 13:57:45.000000000 -0300
+++ rvm_plugin_diff-0.2.new 2017-01-26 13:57:45.000000000 -0300
@@ -12,10 +12,11 @@
   License: GNU General Public License version 2 or later
   http://www.gnu.org/licenses/gpl.html
 **/

function rvm_plugin_diff($event, $step) {
+  global $DB;
   pagetop('Plugin Diff');

   $name = gps('name');
   $nospace = gps('nospace') ? 1 : 0;
   $context = is_numeric(gps('context')) ? intval(gps('context')) : '5';
@@ -45,11 +46,11 @@
     fInput('submit','','Show Changes','publish')
   );
   echo '</div>';
   echo '<br style="clear:both" />';

-  $rs = safe_row('code,code_restore,name,version', 'txp_plugin', "name='".mysql_real_escape_string($name)."'");
+  $rs = safe_row('code,code_restore,name,version', 'txp_plugin', "name='".mysqli_real_escape_string($DB->link, $name)."'");
   if (!$rs) return;
   extract($rs);
   unset($rs);

   # force Unix-style line breaks

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2017-01-26 21:38:59

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_plugin_diff (v0.2)

Thanks. I’ve updated the plugin. Slightly different approach to retain compatibility with older versions.

Offline

#11 2021-06-25 02:22:51

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,051
Website

Re: rvm_plugin_diff (v0.2)

Using this plugin with TXP 4.8.8-dev / PHP 8.07 a few warnings:

Warning "Undefined array key "xxxxxxx""
in /Users/username/Sites/testlocal/textpattern/plugins/rvm_plugin_diff/rvm_plugin_diff.php at line 87.
textpattern/plugins/rvm_plugin_diff/rvm_plugin_diff.php:87 adminErrorHandler()
textpattern/lib/txplib_misc.php:1589 rvm_plugin_diff()
textpattern/index.php:231 callback_event()

Where xxxxxxx is the string for the change. Repeat for every instance of a change (diff).

But the plugin still works nicely (and is very useful).

BTW – if the plugin is updated, there are 2 smallish (!) issues of unreadable text when in Dark Mode.
The first is the div holding the selector widget at the top which has a background-color specified but no color. Removing the background-color , it is an inline style, solves that.
Second, the two “diff” lines also suffer from the lack of specified color, in those two cases, adding color: #222 to the respective inline styles solves.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB