Rename maybe_regenerate_attachment_metadata() to wp_maybe_generate_attachment_metadata(), to match wp_generate_attachment_metadata().
fixes #26825. Built from https://develop.svn.wordpress.org/trunk@27397 git-svn-id: http://core.svn.wordpress.org/trunk@27245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
978e394248
commit
0422c70fdb
|
@ -2562,13 +2562,13 @@ function get_post_gallery_images( $post = 0 ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If an attachment is missing its metadata, try to regenerate it
|
* If an attachment is missing its metadata, try to generate it.
|
||||||
*
|
*
|
||||||
* @since 3.9.0
|
* @since 3.9.0
|
||||||
*
|
*
|
||||||
* @param post $attachment Post object.
|
* @param post $attachment Post object.
|
||||||
*/
|
*/
|
||||||
function maybe_regenerate_attachment_metadata( $attachment ) {
|
function wp_maybe_generate_attachment_metadata( $attachment ) {
|
||||||
if ( empty( $attachment ) || ( empty( $attachment->ID ) || ! $attachment_id = (int) $attachment->ID ) ) {
|
if ( empty( $attachment ) || ( empty( $attachment->ID ) || ! $attachment_id = (int) $attachment->ID ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2577,7 +2577,7 @@ function maybe_regenerate_attachment_metadata( $attachment ) {
|
||||||
$meta = wp_get_attachment_metadata( $attachment_id );
|
$meta = wp_get_attachment_metadata( $attachment_id );
|
||||||
if ( empty( $meta ) && file_exists( $file ) ) {
|
if ( empty( $meta ) && file_exists( $file ) ) {
|
||||||
$_meta = get_post_meta( $attachment_id );
|
$_meta = get_post_meta( $attachment_id );
|
||||||
$regeneration_lock = 'wp_regenerating_' . $attachment_id;
|
$regeneration_lock = 'wp_generating_att_' . $attachment_id;
|
||||||
if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $regeneration_lock ) ) {
|
if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $regeneration_lock ) ) {
|
||||||
set_transient( $regeneration_lock, $file );
|
set_transient( $regeneration_lock, $file );
|
||||||
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
|
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
|
||||||
|
|
Loading…
Reference in New Issue