From d5dfe1b36103c4b1e73be64a5e9091d1faf2c3e0 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Sat, 30 Aug 2008 16:37:40 +0000 Subject: [PATCH] MDL-15362 - better robustness in wakeup MDL-14591 - fixed a bug in portfolio queued transport (not saving updates) --- lib/portfoliolib.php | 1 + portfolio/type/mahara/lib.php | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index b50eab096c..caf91d1080 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -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; } diff --git a/portfolio/type/mahara/lib.php b/portfolio/type/mahara/lib.php index 61e5b56efc..e25495e427 100644 --- a/portfolio/type/mahara/lib.php +++ b/portfolio/type/mahara/lib.php @@ -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; } -- 2.39.5