revert fix #7522
authorleon <leon@roojs.com>
Wed, 19 Apr 2023 07:38:09 +0000 (15:38 +0800)
committerleon <leon@roojs.com>
Wed, 19 Apr 2023 07:38:09 +0000 (15:38 +0800)
File/Convert.php

index 46b554a..a716761 100644 (file)
  * $fn = $x->convert("application/pdf"); // does no conversion (as it's the same.
  * $x->serve('inline'); // can fix IE Mess...
  * 
- * options 
- * {
- *   delete_all : delete all the generated files after script execution when we call convert()
- * }
  * 
  */
 /*
@@ -159,11 +155,6 @@ class File_Convert
             }
             $action->debug = $this->debug;
             $fn = $action->runconvert($this->fn, $x, $y, $pg);
-            // delete the generated files after script execution
-            if(!empty(self::$options['delete_all'])) {
-                $this->deleteOnExitAdd($fn);
-            }
-
             if (!$fn) {
                 $this->to = $toMimetype;
                 $this->lastaction = $action->last ? $action->last : $action; // what failed.
@@ -199,11 +190,6 @@ class File_Convert
             //print_r($x); print_r(' > '); print_r($y);exit;
             
             $fn = $sc->runconvert($fn,  $x, $y, $pg);
-
-            // delete the generated files after script execution
-            if(!empty(self::$options['delete_all'])) {
-                $this->deleteOnExitAdd($fn);
-            }
           
         }
 //        print_r($this->target);
@@ -505,29 +491,8 @@ class File_Convert
         $this->log[] = $str;
     }
     
-    static $deleteOnExit = false;
-    /**
-     * generate a tempory file with an extension (dont forget to delete it)
-     */
-    
-    function deleteOnExitAdd($name)
-    {
-        if (self::$deleteOnExit === false) {
-            register_shutdown_function(array('File_Convert','deleteOnExit'));
-            self::$deleteOnExit  = array();
-        }
-        self::$deleteOnExit[] = $name;
-    }
     
-    static function deleteOnExit()
-    {
         
-        foreach(self::$deleteOnExit as $fn) {
-            if (file_exists($fn)) {
-                unlink($fn);
-            }
-        }
-    }