From a088e511f5ac83f2b4f59a7dcd5dfa973e373bb0 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 7 Apr 2014 17:18:39 -0500
Subject: [PATCH] file: Force dump of file contents

Instead of allowing the backend to send a redirect URL, which doesn't make
sense on the command line
---
 setup/cli/modules/file.php | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/setup/cli/modules/file.php b/setup/cli/modules/file.php
index 3c9f434b7..01deb67b5 100644
--- a/setup/cli/modules/file.php
+++ b/setup/cli/modules/file.php
@@ -76,8 +76,9 @@ class FileManager extends Module {
             if ($files->count() != 1)
                 $this->fail('Criteria must select exactly 1 file');
 
-            $f = AttachmentFile::lookup($files[0]->id);
-            $f->sendData();
+            if (($f = AttachmentFile::lookup($files[0]->id))
+                    && ($bk = $f->open()))
+                $bk->passthru();
             break;
 
         case 'migrate':
@@ -189,12 +190,6 @@ class TicketAttachmentModel extends VerySimpleModel {
         ),
     );
 }
-class TicketModel extends VerySimpleModel {
-    static $meta = array(
-        'table' => TICKET_TABLE,
-        'pk' => 'ticket_id',
-    );
-}
 
 Module::register('file', 'FileManager');
 ?>
-- 
GitLab