]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16520 portfolio: when an exception happens, kill the active export
authormjollnir_ <mjollnir_>
Sun, 1 Mar 2009 11:01:57 +0000 (11:01 +0000)
committermjollnir_ <mjollnir_>
Sun, 1 Mar 2009 11:01:57 +0000 (11:01 +0000)
lib/portfolio/exceptions.php

index 2ca305c4bfbce9fad1be18998a54c19739964663..2e4c5fd004117e8583935a91e214a0faeb54555c 100644 (file)
@@ -46,7 +46,7 @@ class portfolio_export_exception extends portfolio_exception {
     * @param mixed $a language string data (optional, defaults to  null)
     */
     public function __construct($exporter, $errorcode, $module=null, $continue=null, $a=null) {
-        global $SCRIPT, $CFG;
+        global $CFG;
 
         if (!empty($exporter) && $exporter instanceof portfolio_exporter) {
             if (empty($continue)) {
@@ -55,9 +55,10 @@ class portfolio_export_exception extends portfolio_exception {
                     $continue = $exporter->get('caller')->get_return_url();
                 }
             }
-            if ($SCRIPT == "/$CFG->admin/cron.php") {
-                $exporter->process_stage_cleanup();
-            }
+            // this was previously only called if we were in cron,
+            // but I think if there's always an exception, we should clean up
+            // rather than force the user to resolve the export later.
+            $exporter->process_stage_cleanup();
         } else {
             global $SESSION;
             if (!empty($SESSION->portfolioexport)) {