Stuck upgrading mantis ADMIN checks plugin
Moderators: Developer, Contributor
Stuck upgrading mantis ADMIN checks plugin
Hello,
I'm upgrading mantis to version 2.25.7.
When checking the admin page, I get a plugin error without any more info, just :
installed Plugin 'XXX'' is operational + FAIL.
It's not a matter of the plugin tested because if I remove this plugin (which isn't very used) -> https://github.com/mantisbt-plugins/csv ... /README.md, I have the same error on MantisCore.
I added debugs in the check_api.php, please check screenshot : As we can see error is :
APPLICATION WARNING #2400: L’événement « EVENT_UPDATE_BUG_DATA » n’est pas encore défini. (translation : EVENT is not defined)
Raised in file /opt/mantisbt-2.25.7/core/event_api.php on line 96
I have no clue how to fix, can anyone help ?
Thanks
Kind regards
Jules
PS : forgive logs in french
I'm upgrading mantis to version 2.25.7.
When checking the admin page, I get a plugin error without any more info, just :
installed Plugin 'XXX'' is operational + FAIL.
It's not a matter of the plugin tested because if I remove this plugin (which isn't very used) -> https://github.com/mantisbt-plugins/csv ... /README.md, I have the same error on MantisCore.
I added debugs in the check_api.php, please check screenshot : As we can see error is :
APPLICATION WARNING #2400: L’événement « EVENT_UPDATE_BUG_DATA » n’est pas encore défini. (translation : EVENT is not defined)
Raised in file /opt/mantisbt-2.25.7/core/event_api.php on line 96
I have no clue how to fix, can anyone help ?
Thanks
Kind regards
Jules
PS : forgive logs in french
Re: Stuck upgrading mantis ADMIN checks plugin
Which version was installed before 2.25.7?
Which PHP version are you using?
How did you run the upgrade? (provide step by step instructions)
Which PHP version are you using?
How did you run the upgrade? (provide step by step instructions)
Re: Stuck upgrading mantis ADMIN checks plugin
Hello atrol,
I'm upgrading from mantis 2.18.0.
I'm using PHP 8.1.2.
I followed this upgrading https://www.mantisbt.org/docs/master/en ... grade.html
Steps were :
1 - Downloading new mantis version
2 - Unzip
3 - Deleting the config folder
4 - Recreating the symbolic link to the config folder (we use a custom config folder) so it's easier to maintain when upgrading (it's where we place the custom constants / strings / configs etc)
5 - Recreating the symbolic link to a custom plugin folder from /plugins folder (we have custom plugin to handle tables)
6 - Redownloaded the plugin CSV mentioned + installed as following instructions (https://github.com/mantisbt-plugins/csv ... /README.md)
7 - Lauching the install.php + using it
8 - Fixing error LDAP (had to add "$g_ldap_use_starttls = OFF;")
9 - Deleted the doc folder
10 - Fixing a few kernel sources (cfdef_standard.php, BugFilterQuery.class.php, custom_field_api.php, mc_project_api.php, gpc_api.php, filter_form_api.php) because we have a custom plugin to handle tables
11 - Fixing a few kernel sources just to restrict the summary max characters : (bug_change_status_page.php, bug_report_page.php, bug_update_page.php)
12 - Testing out a bit mantis & our plugin to see if something is broken but everything look fine
13 - Trying to fix paths errors from the admin page admin/check/index.php :
core_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the core_path directory outside the web root. WARN
class_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the class_path directory outside the web root. WARN
library_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the library_path directory outside the web root. WARN
language_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the language_path directory outside the web root. WARN
but couldn't make it work so I just let it like that, reverted what I tried
14 - Again, fixed a few errors that I don't remember from the admin page admin/check/index.php
15 - Trying to debug + facing that error on the plugin ...
PS : I went ahead and tested again mantis but I get that error now ... might be linked Kind regards
Jules
I'm upgrading from mantis 2.18.0.
I'm using PHP 8.1.2.
I followed this upgrading https://www.mantisbt.org/docs/master/en ... grade.html
Steps were :
1 - Downloading new mantis version
2 - Unzip
3 - Deleting the config folder
4 - Recreating the symbolic link to the config folder (we use a custom config folder) so it's easier to maintain when upgrading (it's where we place the custom constants / strings / configs etc)
5 - Recreating the symbolic link to a custom plugin folder from /plugins folder (we have custom plugin to handle tables)
6 - Redownloaded the plugin CSV mentioned + installed as following instructions (https://github.com/mantisbt-plugins/csv ... /README.md)
7 - Lauching the install.php + using it
8 - Fixing error LDAP (had to add "$g_ldap_use_starttls = OFF;")
9 - Deleted the doc folder
10 - Fixing a few kernel sources (cfdef_standard.php, BugFilterQuery.class.php, custom_field_api.php, mc_project_api.php, gpc_api.php, filter_form_api.php) because we have a custom plugin to handle tables
11 - Fixing a few kernel sources just to restrict the summary max characters : (bug_change_status_page.php, bug_report_page.php, bug_update_page.php)
12 - Testing out a bit mantis & our plugin to see if something is broken but everything look fine
13 - Trying to fix paths errors from the admin page admin/check/index.php :
core_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the core_path directory outside the web root. WARN
class_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the class_path directory outside the web root. WARN
library_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the library_path directory outside the web root. WARN
language_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the language_path directory outside the web root. WARN
but couldn't make it work so I just let it like that, reverted what I tried
14 - Again, fixed a few errors that I don't remember from the admin page admin/check/index.php
15 - Trying to debug + facing that error on the plugin ...
PS : I went ahead and tested again mantis but I get that error now ... might be linked Kind regards
Jules
Re: Stuck upgrading mantis ADMIN checks plugin
Update : error without a doubt is due to our custom plugin, if I uninstall it, I no more get errors on plugins (in the admin/check page)
Here is the content of our plugin : (file blurred code is : )
Update 2 : if I delete this row :
Update 4 (final update ) : sorry for debugging my "own plugin", I didn't code it , it's quite hard to read but it doesn't seem like the function pgg_check_table is doing anything anyways (someone can confirm, yes?) so I went ahead and remove both the EVENT_UPDATE_BUG_DATA hook + the function. Everything works well.
@atrol, is that normal that the hook didn't work ? Just for knowledge
Here is the content of our plugin : (file blurred code is : )
Code: Select all
<?php
require( 'pages/utils.php' );
class pggPlugin extends MantisPlugin{
function register(){
$this->name = lang_get('plugin_pgg_Table_title');
$this->description = lang_get('plugin_pgg_Table_description');
$this->page = 'config';
$this->version = '1.0';
$this->requires = array(
'MantisCore' => '2.18.0',
);
$this->author = 'xxxx xxxx';
$this->contact = 'xxxx.xxxx@xxxx.fr';
$this->url = 'https://www.xxxxxx.fr/';
}
function config(){
return array(
'conf_auto_load' => true,
'auto_load_threshold' => MANAGER,
'debug_interface_active' => true,
);
}
function hooks(){
return array(
'EVENT_LAYOUT_RESOURCES' => 'resources',
'EVENT_REPORT_BUG_FORM' => 'pgg_display_field_on_create',
'EVENT_UPDATE_BUG_STATUS_FORM' => 'pgg_display_field_on_status_change',
'EVENT_UPDATE_BUG_FORM' => 'pgg_display_field_on_update',
//'EVENT_UPDATE_BUG_DATA' => 'pgg_save_custom_field',
'EVENT_VIEW_BUG_DETAILS' => 'pgg_display_field_on_view',
'EVENT_UPDATE_BUG_DATA ' => 'pgg_check_table'
);
}
function resources($p_event) {
return
'<link rel="stylesheet" type="text/css" href="https://unpkg.com/bootstrap-table@1.22.0/dist/bootstrap-table.min.css"></link>'
. '<script src="https://unpkg.com/bootstrap-table@1.22.0/dist/bootstrap-table.min.js"></script>'
. '<script src="https://unpkg.com/bootstrap-table@1.22.0/dist/bootstrap-table-locale-all.min.js"></script>'
. '<link rel="stylesheet" type="text/css" href="' . plugin_file( 'jquery-ui.css' ) . '"></link>'
. '<script type="text/javascript" src="' . plugin_file( 'jquery-ui.js' ) . '"></script>';
}
function pgg_display_field_on_create( $p_event, $p_project_id ){
pgg_display_field_with_wkf( null, $p_project_id, config_get( 'bug_submit_status' ), true );
}
function pgg_display_field_on_status_change( $p_event, $p_bug_data ){
$t_project_id = bug_get( $p_bug_data, false )->project_id;
pgg_display_field_with_wkf( $p_bug_data, $t_project_id, gpc_get_int( 'new_status' ), true );
}
function pgg_display_field_on_update( $p_event, $p_bug_data ){
$t_project_id = bug_get( $p_bug_data, false )->project_id;
pgg_display_all_fields_update($p_bug_data, $t_project_id);
}
function pgg_display_field_on_view( $p_event, $p_bug_data ){
$t_project_id = bug_get( $p_bug_data, false )->project_id;
pgg_display_all_fields_view($p_bug_data, $t_project_id);
}
function pgg_check_table( $p_event, $p_bug_data_after, $p_bug_data_before ){
return $p_bug_data_after;
}
}
?>
, I no more have errors in the admin/check page but I still have the error'EVENT_UPDATE_BUG_DATA ' => 'pgg_check_table'
Update 3 : for some reasons that are unclear, steps 10 and 11 were reverted ... (back to original sources), I fixed it, and now, I no more have the errorAPPLICATION ERROR #1304 : Definition of custom field not valid
, I can modify / create bugs fine. But still have theAPPLICATION ERROR #1304 : Definition of custom field not valid
error.'EVENT_UPDATE_BUG_DATA ' => 'pgg_check_table'
Update 4 (final update ) : sorry for debugging my "own plugin", I didn't code it , it's quite hard to read but it doesn't seem like the function pgg_check_table is doing anything anyways (someone can confirm, yes?) so I went ahead and remove both the EVENT_UPDATE_BUG_DATA hook + the function. Everything works well.
@atrol, is that normal that the hook didn't work ? Just for knowledge
Re: Stuck upgrading mantis ADMIN checks plugin
Wrong
Should be
Of course, you can keep the line dropped, as function pgg_check_table does not check or change any data.
Code: Select all
'EVENT_UPDATE_BUG_DATA ' => 'pgg_check_table'
Code: Select all
'EVENT_UPDATE_BUG_DATA' => 'pgg_check_table'
Re: Stuck upgrading mantis ADMIN checks plugin
Doesn't this mean, that you lose the latest versions of the plugins that come out of the box with MantisBT?5 - Recreating the symbolic link to a custom plugin folder from /plugins folder (we have custom plugin to handle tables)
Re: Stuck upgrading mantis ADMIN checks plugin
Good catch I'm so blind ...atrol wrote: 21 Aug 2023, 11:02 WrongShould beCode: Select all
'EVENT_UPDATE_BUG_DATA ' => 'pgg_check_table'
Of course, you can keep the line dropped, as function pgg_check_table does not check or change any data.Code: Select all
'EVENT_UPDATE_BUG_DATA' => 'pgg_check_table'
Sorry !
It works fine when fixing that extra space. I'll just remove it since it's dead code, doesn't do anything, to avoid further confusion.
Thanks !
It also means that everytime we modify a plugin / install a plugin, it's a good idea to re-download the admin folder ?
Last edited by JulesA on 21 Aug 2023, 12:44, edited 2 times in total.
Re: Stuck upgrading mantis ADMIN checks plugin
No no, only the link to our plugin is created (blurred in the capture.png), please see screenshot for the plugins folder :atrol wrote: 21 Aug 2023, 11:04Doesn't this mean, that you lose the latest versions of the plugins that come out of the box with MantisBT?5 - Recreating the symbolic link to a custom plugin folder from /plugins folder (we have custom plugin to handle tables)
Re: Stuck upgrading mantis ADMIN checks plugin
Of course, it is.It also means that everytime we modify a plugin / install a plugin, it's a good idea to re-download the admin folder ?
I would move the folder to a place in the file system that can't be reached by the web server and move it back when needed.
Even better to have a complete separate test installation, not reachable by users, where you can try any changes before you roll it out to your production system.
Re: Stuck upgrading mantis ADMIN checks plugin
Yes, we do have two separate environments, but I'm not sure admin folder was used to test the plugin, I doubt.
Thanks for the answer.
Final question, about the paths warnings :
I just have to add this in the config file + move folders right ?
Jules
Thanks for the answer.
Final question, about the paths warnings :
I tried following this subject : https://mantisbt.org/forums/viewtopic.php?t=23994 but couldn't make it work, mantis homepage was all white.Paths
core_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the core_path directory outside the web root. WARN
class_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the class_path directory outside the web root. WARN
library_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the library_path directory outside the web root. WARN
language_path configuration option is set to a path outside the web root
For increased security it is recommended that you move the language_path directory outside the web root. WARN
I just have to add this in the config file + move folders right ?
Code: Select all
$g_core_path = '/<somewhereOutsideWebRoot>/share/MantisBT/core/';
$g_class_path = '/<somewhereOutsideWebRoot>/share/MantisBT/core/classes/';
$g_library_path = '/<somewhereOutsideWebRoot>/share/MantisBT/library/';
$g_language_path = '/<somewhereOutsideWebRoot>/share/MantisBT/lang/';
Re: Stuck upgrading mantis ADMIN checks plugin
There is a known problem with these settings.
I created a bug report for that some years ago, but never had time to have a deeper look or to fix it myself https://www.mantisbt.org/bugs/view.php?id=21584
I had a very short look at the current code.
There are quite a lot of changes around this code since I reported this bug, so my original analysis, as well as some notes and hints of other users might be wrong.
I created a bug report for that some years ago, but never had time to have a deeper look or to fix it myself https://www.mantisbt.org/bugs/view.php?id=21584
I had a very short look at the current code.
There are quite a lot of changes around this code since I reported this bug, so my original analysis, as well as some notes and hints of other users might be wrong.
Re: Stuck upgrading mantis ADMIN checks plugin
Alright, thanks for the link, I had a look at it but couldn't make it work.
I'll check again.
Thanks a lot for the time spent, thanks for the precious help.
Have a great day.
Jules
I'll check again.
Thanks a lot for the time spent, thanks for the precious help.
Have a great day.
Jules