View Issue Details

IDProjectCategoryView StatusLast Update
0024509mantisbtplug-inspublic2018-05-31 06:10
Reporter123 Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Product Version2.14.0 
Summary0024509: public function upgrade( $p_schema )
Description

The following is written in the MantisPlugin.class.php file:

/ **
* This callback is executed after the normal schema upgrade process has executed.
* This gives your plugin the chance to convert or normalize data after an upgrade
*
* @todo It is possible to call php functions from within the schema upgrade itself, so really needed?
*
* @param integer $ p_schema Schema Version ID.
* @return boolean
* /
public function upgrade ($ p_schema) {
return true;
}

And in plugin_api.pxp this function is executed before the schema update:

$ i = $ t_schema_version + 1;
while ($ i <count ($ t_schema)) {
if (! $ p_plugin-> upgrade ($ i)) {
plugin_pop_current ();
return false;
}
$ t_target = $ t_schema [$ i] [1] [0];
switch ($ t_schema [$ i] [0]) {
case 'InsertData':

Why?
I apologize in advance, maybe I did not fully understand.

I change the database schema in the plugin. I need to convert the data after changing the schema.

TagsNo tags attached.

Activities

123

123

2018-05-31 06:02

reporter   ~0059986

I get it.
I will use UpdateFunction.

This is not a simple description of the confusing.

dregad

dregad

2018-05-31 06:10

developer   ~0059987

A bit difficult to answer without specific information about what changes you made or what conversion is needed.

In any case, as mentioned in the method's PHPDoc

  • @todo It is possible to call php functions from within the schema upgrade itself, so really needed?

I would recommend to perform the data conversion via an upgrade step in the plugin's schema() method, using an UpdateSQL or UpdateFunction step.

Issue History

Date Modified Username Field Change
2018-05-31 05:03 123 New Issue
2018-05-31 05:35 dregad Description Updated View Revisions
2018-05-31 05:36 dregad Description Updated View Revisions
2018-05-31 06:02 123 Note Added: 0059986
2018-05-31 06:10 dregad Note Added: 0059987