[wp-trac] [WordPress Trac] #6814: Async media crunching
WordPress Trac
noreply at wordpress.org
Mon May 20 07:26:22 UTC 2019
#6814: Async media crunching
----------------------------------+-----------------------------
Reporter: matt | Owner: koopersmith
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future Release
Component: Upload | Version: 2.5
Severity: normal | Resolution:
Keywords: blessed has-dev-note | Focuses: performance
----------------------------------+-----------------------------
Changes (by ramon fincken):
* keywords: blessed => blessed has-dev-note
* focuses: => performance
Comment:
Stepping in on this one .. we have some code that we ship at all our
customers' installs, it will temporary remove the extra image sizes.
Therefore no extra images will be created based on the original upload. It
sets a meta flag on the uploaded item.
On each WP call, except a new upload the thumbs will be created.
A small snippet of this part:
{{{#!php
<?php
$sql = $wpdb->prepare( 'SELECT post_id FROM '. $wpdb->postmeta . ' WHERE
meta_key = %s LIMIT %d', $this->thumbslaterkey, $this->batch_limit );
foreach( $wpdb->get_results( $sql ) as $thumbs_later ) {
if( $this->init( $thumbs_later->post_id ) ) {
delete_post_meta( $thumbs_later->post_id, $this->thumbslaterkey );
}
}
}}}
It is not said that this postmeta is the best in terms of optimization. A
non-autoloaded option could also be used for this. However we use a batch
limit in the SELECT clause.
Are you interested in the whole code or the pseudocode ?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/6814#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list