? 919172-2_dont_delete.patch
? 919172-9_dont_delete.patch
? libraries/simplepie.inc
? tests/.DS_Store
Index: plugins/FeedsParser.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsParser.inc,v
retrieving revision 1.22
diff -u -p -r1.22 FeedsParser.inc
--- plugins/FeedsParser.inc	15 Sep 2010 16:44:50 -0000	1.22
+++ plugins/FeedsParser.inc	25 Sep 2010 15:27:35 -0000
@@ -197,18 +197,28 @@ class FeedsEnclosure extends FeedsElemen
   protected $file;
 
   /**
+   * Delete flag, denoting whether a file should be deleted when this object
+   * is destroyed.
+   *
+   * @see __destruct()
+   * @see getFile()
+   */
+  protected $delete_file;
+
+  /**
    * Constructor, requires MIME type.
    */
   public function __construct($value, $mime_type) {
     parent::__construct($value);
     $this->mime_type = $mime_type;
+    $this->delete_file = FALSE;
   }
 
   /**
    * Destructor, clean up any temporary files.
    */
   public function __destruct() {
-    if (!empty($this->file)) {
+    if (!empty($this->file) && $this->delete_file) {
       file_delete($this->file);
     }
   }
@@ -236,9 +246,10 @@ class FeedsEnclosure extends FeedsElemen
 
   /**
    * @return
-   *   A temporary file path to the downloaded resource referenced by the
-   *   enclosure. Downloads resource if not downloaded yet. The file path is
-   *   valid for the time of the page load.
+   *   A path pointing to a file containing the resource referenced by the
+   *   enclosure. This method downloads the resource if it is not local. The
+   *   file path must be considered temporary and is only valid for the current
+   *   page load.
    *
    * @todo Get file extension from mime_type.
    * @todo This is not concurrency safe.
@@ -270,6 +281,7 @@ class FeedsEnclosure extends FeedsElemen
       if ($this->file === 0) {
         throw new Exception(t('Cannot write content to %dest', array('%dest' => $dest)));
       }
+      $this->delete_file = TRUE;
     }
     return $this->file;
   }
