Making WordPress.org


Ignore:
Timestamp:
03/09/2015 06:26:28 AM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Avoid warnings when adding a new version on upload.

If it's a first-time theme upload, $meta will be false and checking a
previous status of that new version will trigger a warning.
On all other uploads the new version number will not be set, also triggering
a warning.

See https://wordpress.slack.com/archives/dotorg-warnings/p1425880912003372

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r1382 r1387  
    276276 */
    277277function wporg_themes_update_version_status( $post_id, $current_version, $new_status ) {
    278     $meta       = get_post_meta( $post_id, '_status', true );
    279     $old_status = $meta[ $current_version ];
     278    $meta       = (array) get_post_meta( $post_id, '_status', true );
     279    $old_status = isset( $meta[ $current_version ] ) ? $meta[ $current_version ] : false;
    280280
    281281    // Don't do anything when the status hasn't changed.
Note: See TracChangeset for help on using the changeset viewer.