history_get_raw_events_array returns no data
Moderators: Developer, Contributor
history_get_raw_events_array returns no data
I am trying to hack some override functions together to generate some data for an IRC bot.
I created the file custom_functions_inc.php in the main folder.
In this file I created the functions:
* custom_function_override_issue_create_notify
* custom_function_override_issue_delete_notify
* custom_function_override_issue_update_notify
in custom_function_override_issue_update_notify, I call history_get_raw_events_array to get access to the history of an issue, but this does not seem to return any data. Neither does history_get_events_array.
Am I not allowed to call this function?
Do I need to include some file? (I tried with require_once ("core/history_api.php"); )
It's the history data that I would like to use for the IRC bot.
(btw, the overrides for update and delete do not work in rc5, I had to fix them myself, fix pending ;) )
edit: perhaps it was better to post it in the help section...
I created the file custom_functions_inc.php in the main folder.
In this file I created the functions:
* custom_function_override_issue_create_notify
* custom_function_override_issue_delete_notify
* custom_function_override_issue_update_notify
in custom_function_override_issue_update_notify, I call history_get_raw_events_array to get access to the history of an issue, but this does not seem to return any data. Neither does history_get_events_array.
Am I not allowed to call this function?
Do I need to include some file? (I tried with require_once ("core/history_api.php"); )
It's the history data that I would like to use for the IRC bot.
(btw, the overrides for update and delete do not work in rc5, I had to fix them myself, fix pending ;) )
edit: perhaps it was better to post it in the help section...
-
Guest
It would be great if you can submit any fixes to http://bugs.mantisbt.org. Also the code for the integration with IRC.
You will need to include any core API that you are using. In this case core/history_api.php as you indicated.
require_once( dirname(__FILE__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'history_api.php' );
The above code will guarantee that the path is correct independent of where the custom functions header file is included from.
Regards,
Victor
MantisConnect
http://www.futureware.biz
You will need to include any core API that you are using. In this case core/history_api.php as you indicated.
require_once( dirname(__FILE__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'history_api.php' );
The above code will guarantee that the path is correct independent of where the custom functions header file is included from.
Regards,
Victor
MantisConnect
http://www.futureware.biz
strange, this is what I did:
require_once( dirname(__FILE__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'history_api.php' );
in the file custom_functions_inc.php. There I made the following function:
for some reason this results in _updatefile.txt:
I don't get any content of the history. If I put this code in history_api.php, I get all the necessary info in the textfile.
what's going wrong here?
require_once( dirname(__FILE__) . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'history_api.php' );
in the file custom_functions_inc.php. There I made the following function:
Code: Select all
function custom_function_override_issue_update_notify( $p_issue_id ) {
if (file_exists("_updatefile.txt")){
$contents = file_get_contents("_updatefile.txt");
}
else $contents ="";
$output="issue updated: ".$p_issue_id."\n";
$newfile="_updatefile.txt";
$file = fopen ($newfile, "w");
fwrite($file, $contents);
fwrite($file, $output);
fflush($file);
$hist = history_get_raw_events_array( $p_bug_id );
$history_count = count( $hist );
$output="history ($history_count): ";
for ( $i=0; $i < $history_count; $i++ ) {
$output.=$hist[$i]['date']."\t";
$output.=$hist[$i]['userid']."\t";
$output.=$hist[$i]['field']."\t";
$output.=$hist[$i]['type']."\t";
$output.=$hist[$i]['old_value']." => ";
$output.=$hist[$i]['new_value']."\t";
$output.=$hist[$i]['username']."\n";
}
fwrite($file, $output."\n");
fclose ($file);
}Code: Select all
issue updated: 24
history (0):what's going wrong here?
I submitted the fixes for the custom functions hereAnonymous wrote:It would be great if you can submit any fixes to http://bugs.mantisbt.org. Also the code for the integration with IRC.
When I succeeded in creating an IRC bot that makes use of the code I'm working on I will post the IRC bot here so other people can make use of it. I just need to work out some kind of protocol.
The parameter name is $p_issue_id and you use $p_bug_id.
Regards,
Victor.
Mantis Blog
http://www.futureware.biz/
Regards,
Victor.
Mantis Blog
http://www.futureware.biz/
I would recommend you make sure that notices are ON, this will catch such things for you.
Let me know when you get things running :)
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect
Let me know when you get things running :)
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect