Ticket #1253 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Update Plugin Version in Config.DB for enabled plugins only, please add to trunk :)

Reported by: bowtie Owned by: bowtie
Priority: major Milestone:
Component: plugins Version: 0.86
Keywords: Plugin version Cc: Alias

Description

I noticed that the Plugins DB was not being updated when a plugin version changed, so here is a fix. for active plugins only.

  • lib/Padre/PluginManager.pm

     
    656656            $locale->AddCatalogLookupPathPrefix($dir); 
    657657        } 
    658658    } 
     659     
     660    # update version for enabled plugins 
     661    Padre::DB::Plugin->update_version( 
     662        $module => $module->VERSION, 
     663    ); 
    659664 
    660665    # FINALLY we can enable the plug-in 
    661666    $plugin->enable; 
     
    12411246# LICENSE 
    12421247# This program is free software; you can redistribute it and/or 
    12431248# modify it under the same terms as Perl 5 itself. 
    1244  
  • lib/Padre/DB/Plugin.pm

     
    2626    ); 
    2727} 
    2828 
     29# Set version for an object 
     30sub update_version { 
     31    Padre::DB->do( 
     32        'update plugin set version = ? where name = ?', {}, 
     33        $_[2], $_[1], 
     34    ); 
     35} 
     36 
    29371; 
    3038 
    3139__END__ 
     
    259267 
    260268Returns true, or throws an exception on error. 
    261269 
     270=head2 update_version 
     271 
     272    Padre::DB::Plugin->update_version( 
     273        $module => $module->VERSION, 
     274    ); 
     275 
     276Update Version of Plugin, enables Config.DB to be keeped upto date. 
     277 
    262278=head1 ACCESSORS 
    263279 
    264280=head2 name 

a P-P-Cookbook by product :)

Change History

comment:1 Changed 3 years ago by szabgab

It seems like an easy fix but I wonder why do we care to keep the version numbers in the database? Where do we use them?

comment:2 Changed 3 years ago by bowtie

it's only when you look at ConfigDB via Cookbook do you see it's wrong,
also do we not want all plugins to use ConfigDB and config.ymal for Padre settings?
We can also now check if a previous version was installed.

If we arn't going to update it, then why do we need it.

this would mean that Version and Config are superfluous attributes then :(

comment:3 Changed 3 years ago by bowtie

  • Status changed from new to closed
  • Resolution set to fixed

This has bean implemented in r14980, not as is, but with modification by Alias++

Note: See TracTickets for help on using tickets.