Stop `exit`ing when no output was created in ExportMailAddressUserBulkProcessingAction
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 18 Jun 2019 18:30:18 +0000 (20:30 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 18 Jun 2019 18:30:18 +0000 (20:30 +0200)
wcfsetup/install/files/lib/system/bulk/processing/user/ExportMailAddressUserBulkProcessingAction.class.php

index aa45c14013e67325b2d5f5d9bc0e5b967007ac13..a09d87c03b9627ac4e583de3120fcab79d7a9796 100644 (file)
@@ -33,6 +33,12 @@ class ExportMailAddressUserBulkProcessingAction extends AbstractUserBulkProcessi
         */
        public $textSeparator = '"';
        
+       /**
+        * indicates whether output was generated (i.e. executeAction was called)
+        * @var boolean
+        */
+       private $executed = false;
+       
        /**
         * @inheritDoc
         */
@@ -41,6 +47,8 @@ class ExportMailAddressUserBulkProcessingAction extends AbstractUserBulkProcessi
                        throw new \InvalidArgumentException("Object list is no instance of '".UserList::class."', instance of '".get_class($objectList)."' given.");
                }
                
+               $this->executed = true;
+               
                // send content type
                header('Content-Type: text/'.$this->fileType.'; charset=UTF-8');
                header('Content-Disposition: attachment; filename="export.'.$this->fileType.'"');
@@ -102,6 +110,8 @@ class ExportMailAddressUserBulkProcessingAction extends AbstractUserBulkProcessi
         * @inheritDoc
         */
        public function reset() {
+               if (!$this->executed) return;
+               $this->executed = false;
                exit;
        }
 }