Make WordPress Core


Ignore:
Timestamp:
05/24/2011 03:57:28 PM (15 years ago)
Author:
ryan
Message:

Mark import attachments as private. Schedule job to delete old import attachments. Introduce attachment context.

Location:
branches/3.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.1

  • branches/3.1/wp-admin/includes/import.php

    r16608 r18023  
    8181                'post_content' => $url,
    8282                'post_mime_type' => $type,
    83                 'guid' => $url
     83                'guid' => $url,
     84                'context' => 'import',
     85                'post_status' => 'private'
    8486        );
    8587
    … …  
    8789        $id = wp_insert_attachment( $object, $file );
    8890
     91        // schedule a cleanup for one day from now in case of failed import or missing wp_import_cleanup() call
     92        wp_schedule_single_event( time() + 86400, 'importer_scheduled_cleanup', array( $id ) );
     93
    8994        return array( 'file' => $file, 'id' => $id );
    9095}
Note: See TracChangeset for help on using the changeset viewer.