View Issue Details

IDProjectCategoryView StatusLast Update
1899RackTablesdefaultpublic2022-10-31 17:29
Reporternetniv Assigned Toinfrastation  
PrioritynormalSeveritytweakReproducibilityalways
Status assignedResolutionopen 
Product Version0.21.1 
Summary1899: Documentation on plugin upgrade code is not clear
DescriptionWhen looking through the plugin upgrade code, the documentation makes reference to pluign_PLUGINNAME_install, etc. It then gives an example of upgrade code for 'myplugin' as:

Example modeled after the core RackTables upgrader:


function plugin_myplugin_upgrade ()
{
    $db_info = getPlugin ('myplugin');
    $v1 = $db_info['db_version'];
    $code_info = plugin_plugin_info ();
    $v2 = $code_info['version'];

Additional InformationThis is incorrect as it should be plugin_myplugin_info() which would be the name of the plugin in the example. The documentation should also make it clearer to novice programmers who may try to replicate the code that the previously defined plugin_PLUGINNAME_upgrade would, for a plugin named 'myplugin' become plugin_myplugin_upgrade(). This would then help properly establish the link between the templated names (with uppercase characters) and the example names which have been properly replaced with myplugin.
TagsNo tags attached.

Activities

netniv

netniv

2019-03-07 12:00

reporter   ~0003919

It may be worth adding a table to show how the functions look for 'myplugin'

{| class="wikitable"
!Name
!Becomes
|-
|plugin_PLUGINNAME_info
|plugin_myplugin_info
|-
|plugin_PLUGINNAME_init
|plugin_myplugin_init
|-
|plugin_PLUGINNAME_install
|plugin_myplugin_install
|-
|plugin_PLUGINNAME_uninstall
|plugin_nyplugin_uninstall
|-
|plugin_PLUGINNAME_upgrade
|plugin_myplugin_upgrade
|}
infrastation

infrastation

2019-03-09 21:18

administrator   ~0003921

Thank you for the feedback. Aaron is the best man to review this.
netniv

netniv

2021-07-13 17:26

reporter   ~0004317

I'd forgotten about this.
infrastation

infrastation

2021-07-23 14:13

administrator   ~0004335

I have just looked through the wiki page and this issue, but found it a bit hard to follow. Are you saying that the plugin upgrade function should be
plugin_myplugin_info()
instead of
plugin_myplugin_upgrade()
?
netniv

netniv

2022-10-31 17:29

reporter   ~0004443

Sorry, been a while since I last logged into here. Re-reading what I wrote, I believe that the problem is the inconsistency in the naming. Using _plugin_ instead of _myplugin_ (which would be correct for the example).

Issue History

Date Modified Username Field Change
2019-03-07 11:57 netniv New Issue
2019-03-07 12:00 netniv Note Added: 0003919
2019-03-09 21:18 infrastation Assigned To => adoom42
2019-03-09 21:18 infrastation Status new => assigned
2019-03-09 21:18 infrastation Note Added: 0003921
2021-07-13 17:26 netniv Note Added: 0004317
2021-07-23 14:13 infrastation Assigned To adoom42 => infrastation
2021-07-23 14:13 infrastation Note Added: 0004335
2022-10-31 17:29 netniv Note Added: 0004443