clean_dirsize_cache example



    // Set correct file permissions.     $stat  = stat( dirname( $new_file ) );
    $perms = $stat['mode'] & 0000666;
    chmod( $new_file$perms );

    // Compute the URL.     $url = $uploads['url'] . "/$filename";

    if ( is_multisite() ) {
        clean_dirsize_cache( $new_file );
    }

    /** * Filters the data array for the uploaded file. * * @since 2.1.0 * * @param array $upload { * Array of upload data. * * @type string $file Filename of the newly-uploaded file. * @type string $url URL of the newly-uploaded file. * @type string $type Mime type of the newly-uploaded file. * } * @param string $context The type of upload action. Values include 'upload' or 'sideload'. */
// Set correct file permissions.     $stat  = @ stat( dirname( $new_file ) );
    $perms = $stat['mode'] & 0007777;
    $perms = $perms & 0000666;
    chmod( $new_file$perms );
    clearstatcache();

    // Compute the URL.     $url = $upload['url'] . "/$filename";

    if ( is_multisite() ) {
        clean_dirsize_cache( $new_file );
    }

    /** This filter is documented in wp-admin/includes/file.php */
    return apply_filters(
        'wp_handle_upload',
        array(
            'file'  => $new_file,
            'url'   => $url,
            'type'  => $wp_filetype['type'],
            'error' => false,
        ),
        
return $check;
    }

    delete_post_meta( $post_id, '_wp_trash_meta_status' );
    delete_post_meta( $post_id, '_wp_trash_meta_time' );

    $meta         = wp_get_attachment_metadata( $post_id );
    $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
    $file         = get_attached_file( $post_id );

    if ( is_multisite() && is_string( $file ) && ! empty( $file ) ) {
        clean_dirsize_cache( $file );
    }

    /** * Fires before an attachment is deleted, at the start of wp_delete_attachment(). * * @since 2.0.0 * @since 5.5.0 Added the `$post` parameter. * * @param int $post_id Attachment ID. * @param WP_Post $post Post object. */
    
Home | Imprint | This part of the site doesn't use cookies.