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	1 Jan 2009 05:06:52 -0000
@@ -68,19 +68,11 @@ 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).
+ * (1,2,4,8,16,32,64,128).
  */
 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	1 Jan 2009 05:06:54 -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.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.654
diff -u -p -r1.654 system.module
--- modules/system/system.module	28 Dec 2008 19:11:31 -0000	1.654
+++ modules/system/system.module	1 Jan 2009 05:07:04 -0000
@@ -1513,7 +1513,7 @@ function system_cron() {
   db_query('DELETE FROM {batch} WHERE timestamp < %d', REQUEST_TIME - 864000);
 
   // Remove temporary files that are older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
-  $result = db_query('SELECT fid FROM {files} WHERE status & :permanent != :permanent AND timestamp < :timestamp', array(':permanent' => FILE_STATUS_PERMANENT, ':timestamp' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE));
+  $result = db_query('SELECT fid FROM {files} WHERE status & :permanent > 0 AND timestamp < :timestamp', array(':permanent' => FILE_STATUS_PERMANENT, ':timestamp' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE));
   foreach ($result as $row) {
     if ($file = file_load($row->fid)) {
       if (!file_delete($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	1 Jan 2009 05:07:08 -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	1 Jan 2009 05:07:18 -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);
   }
 }
