Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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.
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
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
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
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!
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
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
Offline
Re: rvm_plugin_diff (v0.2)
Thanks. I’ve updated the plugin. Slightly different approach to retain compatibility with older versions.
Offline
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
Pages: 1