? .DS_Store
? .cache
? .git
? .project
? .settings
? INSTALL.sqlite.txt
? file_353207.patch
? junk
? logs
? remove-file_status_temp.patch
? sites/.DS_Store
? sites/all/modules
? sites/default/.DS_Store
? sites/default/files
? sites/default/settings.php
? sites/default/test
Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.148
diff -u -p -r1.148 file.inc
--- includes/file.inc	31 Dec 2008 11:08:47 -0000	1.148
+++ includes/file.inc	2 Jan 2009 01:31:54 -0000
@@ -20,9 +20,10 @@
  * - filepath - Path of the file relative to Drupal root.
  * - filemime - The file's MIME type.
  * - filesize - The size of the file in bytes.
- * - status - A bitmapped field indicating the status of the file the least
- *   sigifigant bit indicates temporary (1) or permanent (0). Temporary files
- *   older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during a cron run.
+ * - status - A bitmapped field indicating the status of the file. The first 8
+ *   bits are reserved for Drupal core. The least sigifigant bit indicates
+ *   temporary (0) or permanent (1). Temporary files older than
+ *   DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during cron runs.
  * - timestamp - UNIX timestamp for the date the file was added to the database.
  */
 
@@ -68,19 +69,10 @@ define('FILE_EXISTS_REPLACE', 1);
 define('FILE_EXISTS_ERROR', 2);
 
 /**
- * File status -- File has been temporarily saved to the {files} tables.
- *
- * Drupal's file garbage collection will delete the file and remove it from the
- * files table after a set period of time.
- */
-define('FILE_STATUS_TEMPORARY', 0);
-
-/**
- * File status -- File has been permanently saved to the {files} tables.
- *
- * If you wish to add custom statuses for use by contrib modules please expand
- * as binary flags and consider the first 8 bits reserved.
- * (0,1,2,4,8,16,32,64,128).
+ * File status -- This bit in the status indicates that the file is permanent
+ * and should not be deleted during file garbage collection process. Temporary
+ * files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during cron
+ * runs.
  */
 define('FILE_STATUS_PERMANENT', 1);
 
@@ -854,7 +846,7 @@ function file_save_upload($source, $vali
     // Begin building file object.
     $file = new stdClass();
     $file->uid      = $user->uid;
-    $file->status   = FILE_STATUS_TEMPORARY;
+    $file->status   = 0;
     $file->filename = file_munge_filename(trim(basename($_FILES['files']['name'][$source]), '.'), $extensions);
     $file->filepath = $_FILES['files']['tmp_name'][$source];
     $file->filemime = file_get_mimetype($file->filename);
@@ -1138,7 +1130,7 @@ function file_save_data($data, $destinat
     $file->filename = basename($file->filepath);
     $file->filemime = file_get_mimetype($file->filepath);
     $file->uid      = $user->uid;
-    $file->status   = FILE_STATUS_PERMANENT;
+    $file->status  |= FILE_STATUS_PERMANENT;
     return file_save($file);
   }
   return FALSE;
@@ -1758,7 +1750,6 @@ function file_get_mimetype($filename, $m
 
   return 'application/octet-stream';
 }
-
 /**
  * @} End of "defgroup file".
  */
Index: modules/simpletest/tests/file.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/file.test,v
retrieving revision 1.16
diff -u -p -r1.16 file.test
--- modules/simpletest/tests/file.test	31 Dec 2008 11:08:47 -0000	1.16
+++ modules/simpletest/tests/file.test	2 Jan 2009 01:31:58 -0000
@@ -86,7 +86,7 @@ class FileTestCase extends DrupalWebTest
     $file->uid = 1;
     $file->timestamp = REQUEST_TIME;
     $file->filesize = filesize($file->filepath);
-    $file->status = FILE_STATUS_TEMPORARY;
+    $file->status = 0;
     $this->assertNotIdentical(drupal_write_record('files', $file), FALSE, t('The file was added to the database.'));
 
     return $file;
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.33
diff -u -p -r1.33 system.test
--- modules/system/system.test	30 Dec 2008 16:43:19 -0000	1.33
+++ modules/system/system.test	2 Jan 2009 01:32:00 -0000
@@ -263,12 +263,12 @@ class CronRunTestCase extends DrupalWebT
 
     // Temporary file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
     $temp_old = file_save_data('');
-    db_query('UPDATE {files} SET status = :status, timestamp = :timestamp WHERE fid = :fid', array(':status' => FILE_STATUS_TEMPORARY, ':timestamp' => 1, ':fid' => $temp_old->fid));
+    db_query('UPDATE {files} SET status = :status, timestamp = :timestamp WHERE fid = :fid', array(':status' => 0, ':timestamp' => 1, ':fid' => $temp_old->fid));
     $this->assertTrue(file_exists($temp_old->filepath), t('Old temp file was created correctly.'));
 
     // Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
     $temp_new = file_save_data('');
-    db_query('UPDATE {files} SET status = :status WHERE fid = :fid', array(':status' => FILE_STATUS_TEMPORARY, ':fid' => $temp_new->fid));
+    db_query('UPDATE {files} SET status = :status WHERE fid = :fid', array(':status' => 0, ':fid' => $temp_new->fid));
     $this->assertTrue(file_exists($temp_new->filepath), t('New temp file was created correctly.'));
 
     // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.223
diff -u -p -r1.223 upload.module
--- modules/upload/upload.module	31 Dec 2008 11:08:47 -0000	1.223
+++ modules/upload/upload.module	2 Jan 2009 01:32:01 -0000
@@ -528,7 +528,7 @@ function upload_save(&$node) {
         ->condition('vid', $node->vid, '=')
         ->execute();
     }
-    $file->status &= FILE_STATUS_PERMANENT;
+    $file->status |= FILE_STATUS_PERMANENT;
     $file = file_save($file);
   }
 }
