MDL-15362 - better robustness in wakeup

MDL-14591 - fixed a bug in portfolio queued transport (not saving updates)
This commit is contained in:
mjollnir_ 2008-08-30 16:37:40 +00:00
parent 254f2d0534
commit d5dfe1b361
2 changed files with 14 additions and 3 deletions

View File

@ -2405,6 +2405,7 @@ function portfolio_handle_event($eventdata) {
$exporter->process_stage_package();
$exporter->process_stage_send();
$exporter->process_stage_cleanup();
$exporter->save();
return true;
}

View File

@ -263,13 +263,23 @@ class portfolio_plugin_mahara extends portfolio_plugin_pull_base {
$transferid = $DB->get_field('portfolio_mahara_queue', 'transferid', array('token' => $token));
$exporter = portfolio_exporter::rewaken_object($transferid);
} catch (portfolio_exception $e) {
return false; // @todo penny figure out what mnet wants in the error case
exit(mnet_server_fault(8010, 'invalid transfer id'));
}
if ($exporter->get('instance')->get_config('mnethostid') != $MNET_REMOTE_CLIENT->id) {
return false; // @todo penny complain loudly here.. some other host is trying to talk to us
exit(mnet_server_fault(8011, "remote host didn't match saved host"));
}
global $CFG;
$contents = base64_encode($exporter->get('instance')->get('file')->get_content());
try {
$i = $exporter->get('instance');
$f = $i->get('file');
if (empty($f)) {
exit(mnet_server_fault(8012, 'could not find file in transfer object - weird error'));
}
$c = $f->get_content();
$contents = base64_encode($c);
} catch (Exception $e) {
exit(mnet_server_fault(8013, 'could not get file to send'));
}
$exporter->process_stage_cleanup(true);
return $contents;
}