]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15362 - better robustness in wakeup
authormjollnir_ <mjollnir_>
Sat, 30 Aug 2008 16:37:40 +0000 (16:37 +0000)
committermjollnir_ <mjollnir_>
Sat, 30 Aug 2008 16:37:40 +0000 (16:37 +0000)
MDL-14591 - fixed a bug in portfolio queued transport (not saving updates)

lib/portfoliolib.php
portfolio/type/mahara/lib.php

index b50eab096cf512c0b7549a08a8f3b297379a73d0..caf91d10803290178453a4899f8e72bc6ea96073 100644 (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;
 }
 
index 61e5b56efcb6459ad83c19d25bcbe9e88de8d9cf..e25495e42722bd09cdb871d59c37d0f15eba92c6 100644 (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;
     }