[wp-hackers] WP Plugin Update Detect

Alex nessence at gmail.com
Wed Aug 4 18:51:52 UTC 2004


A simple 'Check for Updates' button for the entire plugin page would
be intuitive. If a plugin got installed by enough users, it could
appear like a DoS. I would hope one day there are enough users that
this would be a problem. It may be better to make this interaction
manual.

You could simply prepend (isset($_POST['check_for_updates'])) to your
code. I don't know of any external access that is currently automated
in wordpess. I hope you take this into consideration.

On Tue, 03 Aug 2004 08:37:50 -0500, Ryan Meyers <ryan at ryanmeyers.com> wrote:
> WP Plugin Update Detect
> ©2004 Ryan Meyers
> http://www.ryanmeyers.com
> 
> Anyone want to know when their favorite plugins have been updated?  I
> know that I do!  And even more so, I want users of my plugins to know
> when I've fixed the hundreds of critters running around in them.
> 
> With the few plugins that I've released for public use, it's been
> amazing how many tech support e-mails that flood in each day.  While a
> real bug-report is a great help (thanks Janice!), often it's something
> that's already been fixed.  Users aren't checking the home pages for
> updates, miss or don't read the posts on the hacks forum, and thus have
> no idea that a brand new, better version of your plugin is available for
> their consumption.  This is my attempt at making that process a little
> bit easier.
> 
> Users, please note that adding support for update won't break plugins
> that don't support it.  Authors, please note that adding support for
> update won't break your plugin on users that decide not to utilize it.
> It's an optional component on both ends, but one that's worth taking
> advantage of, I think.
> 
> Once a supported database of WordPress plugins (a la Firefox extensions)
> is created, this feature could possibly reach new levels of ease, speed,
> and usability.  As it is, I think that it will achieve its simple
> purpose with a small footprint, since the files it will be retrieving
> will be a few bytes in size.
> 
> ==========================================================
> 
> FOR WORDPRESS USERS:
> 
> Installation requires editing one file:  wp-admin/plugins.php
> 
> 1) Open wp-admin/plugins.php in your editor
> 
> 2) Find:
>     if ( preg_match("|Version:(.*)|i", $plugin_data, $version) )
>             $version = $version[1];
>         else
>             $version ='';
> 
> 3) After, add:
>         // BEGIN PLUGIN UPDATE ADD-ON
>         if ( preg_match("|Update:(.*)|i", $plugin_data, $update) )
>         {
>             $update = $update[1];
>             $update = trim($update);
>                 if ($u = @file("$update")) {
>                     $u = implode('',$u);
>                     $u = trim($u);
>                     $v = trim($version);
>                     if($u != $v){
>                         $updatelink = '<a href="';
>                         $updatelink .= $plugin_uri[1];
>                         $updatelink .= '">';
>                         $updatelink .= '<em><strong>Update
> Available:</strong> (';
>                         $updatelink .= $u;
>                         $updatelink .= ')</em></a>';
>                         $description[1] .= '<br />';
>                         $description[1] .= $updatelink;
> 
>                                             }
>                     else
>                     {
>                     $updatelink = '';
>                     }
> 
>                 }
>                 else{
>                     $updatelink = '';
>                 }
>         }
>         else
>         {    $update ='';}
> 
>         //END PLUGIN UPDATE ADD-ON
> 
> 4) Upload wp-admin/plugins.php
> 
> 5) Update those plugins!
> 
> ==========================================================
> 
> FOR PLUGIN AUTHORS:
> 
> The trick to making this the best it can be for users is a consistent
> format.  You can alter the code on your end to a certain extent, but the
> idea is for users to easily be able to detect updates to your plugins.
> Keep it simple!
> 
> 1) Upload plugin-update.php to your WordPress root.
> 
> 2) Add a Custom field called 'Current Version' with a value relative to
> your plugin's development to each of your WordPress posts detailing
> their development.
> 
> 3) Add the following line to your plugin source (replace 99999 with the
> ID for the post mentioned above:
>     Update: http://www.yoursite.com/yourwpinstall/plugin-update?p=99999
> 
> ===========================================================
> 
> A NOTE FOR AUTHORS OF PLUGINS:
> 
> In an effort for mass-usability, I'm proposing that plugin authors that
> desire their plugins to be easily updated distrubute the following
> instructions with their plugins and/or distribute this file:
> 
> /************************************
> **                                 **
> **  TO TAKE ADVANTAGE OF UPDATE    **
> **  DETECTION, PLEASE CONSIDER     **
> **  MAKING THE FOLLOWING ADDITION  **
> **  TO YOUR WORDPRESS INSTALL      **
> **                                 **
> *************************************
> 
>   OPEN FOR EDITING : wp-admin/plugins.php
> 
>   FIND :
> 
>      if ( preg_match("|Version:(.*)|i", $plugin_data, $version) )
>               $version = $version[1];
>           else
>               $version ='';
> 
>   ADD THE FOLLOWING CODE AFTERWARDS :
> 
>     // BEGIN PLUGIN UPDATE ADD-ON
>         if ( preg_match("|Update:(.*)|i", $plugin_data, $update) )
>         {
>             $update = $update[1];
>             $update = trim($update);
>                 if ($u = @file("$update")) {
>                     $u = implode('',$u);
>                     $u = trim($u);
>                     $v = trim($version);
>                     if($u != $v){
>                         $updatelink = '<a href="';
>                         $updatelink .= $plugin_uri[1];
>                         $updatelink .= '">';
>                         $updatelink .= '<em><strong>Update
> Available:</strong> (';
>                         $updatelink .= $u;
>                         $updatelink .= ')</em></a>';
>                         $description[1] .= '<br />';
>                         $description[1] .= $updatelink;
> 
>                                             }
>                     else
>                     {
>                     $updatelink = '';
>                     }
> 
>                 }
>                 else{
>                     $updatelink = '';
>                 }
>         }
>         else
>         {    $update ='';}
> 
>         //END PLUGIN UPDATE ADD-ON
> 
> */
> 
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>



More information about the hackers mailing list