Plugin Directory

Changeset 3486388 for polylang


Ignore:
Timestamp:
03/19/2026 10:55:18 AM (9 days ago)
Author:
Chouby
Message:

Version 3.8.1

Location:
polylang
Files:
7 deleted
7 edited
30 copied

Legend:

Unmodified
Added
Removed
  • polylang/tags/3.8.1/polylang.php

    r3484589 r3486388  
    1111 * Plugin URI:        https://polylang.pro
    1212 * Description:       Adds multilingual capability to WordPress
    13  * Version:           3.8
     13 * Version:           3.8.1
    1414 * Requires at least: 6.5
    1515 * Requires PHP:      7.4
     
    5454
    5555// Go on loading the plugin.
    56 define( 'POLYLANG_VERSION', '3.8' );
     56define( 'POLYLANG_VERSION', '3.8.1' );
    5757define( 'PLL_MIN_WP_VERSION', '6.5' );
    5858define( 'PLL_MIN_PHP_VERSION', '7.4' );
  • polylang/tags/3.8.1/readme.txt

    r3484589 r3486388  
    66Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 3.8
     8Stable tag: 3.8.1
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    105105
    106106== Changelog ==
     107
     108= 3.8.1 (2026-03-19) =
     109
     110* Fix fatal error when the cache is suspended #1837 #1839
    107111
    108112= 3.8 (2026-03-17) =
  • polylang/tags/3.8.1/src/translatable-object.php

    r3467776 r3486388  
    252252     * @param int[]  $object_ids Array of object IDs.
    253253     * @param string $taxonomy   Taxonomy name.
    254      * @return array<int,WP_Term|null> Array of terms with object ID as key.
     254     * @return array<int,WP_Term> Array of terms with object ID as key.
    255255     */
    256256    protected function get_object_terms( array $object_ids, string $taxonomy ) {
     
    262262        $cached_values = $this->get_from_object_term_cache( $object_ids, $taxonomy );
    263263
    264         // Flatten the array to prime the terms cache.
    265         $all_term_ids = array();
    266         foreach ( $cached_values as $term_ids ) {
    267             $all_term_ids = array_merge( $all_term_ids, $term_ids );
    268         }
     264        $all_term_ids = array_values( $cached_values );
    269265        _prime_term_caches( $all_term_ids, false );
    270266
    271267        $terms = array();
    272         foreach ( $cached_values as $object_id => $term_ids ) {
    273             if ( ! empty( $term_ids ) ) {
    274                 $term_id = reset( $term_ids ); // There is only one term for language or translation groups.
    275 
    276                 /** @var WP_Term $term */
    277                 $term                = get_term( $term_id );
    278                 $terms[ $object_id ] = $term;
    279             }
     268        foreach ( $cached_values as $object_id => $term_id ) {
     269            /** @var WP_Term $term */
     270            $term                = get_term( $term_id );
     271            $terms[ $object_id ] = $term;
    280272        }
    281273
     
    286278     * Caches all object-relationship terms.
    287279     *
    288      * @since 3.8
     280     * @since 3.8.1
    289281     *
    290282     * @param int[] $object_ids Array of object IDs.
    291283     *
    292      * @return void
    293      */
    294     protected function prime_object_term_cache( array $object_ids ) {
     284     * @return int[][][]
     285     */
     286    protected function update_object_term_cache( array $object_ids ) {
    295287        $non_cached_ids = array();
    296288        foreach ( $this->tax_to_cache as $tax ) {
     
    299291
    300292        if ( empty( $non_cached_ids ) ) {
    301             return;
     293            return array();
    302294        }
    303295
     
    312304
    313305        if ( ! is_array( $terms ) ) {
    314             return;
     306            return array();
    315307        }
    316308
     
    331323            wp_cache_add_multiple( $data, "{$tax}_relationships" );
    332324        }
     325
     326        return $object_terms;
    333327    }
    334328
     
    341335     * @param string $taxonomy   Taxonomy name.
    342336     *
    343      * @return int[][]
    344      */
    345     protected function get_from_object_term_cache( array $object_ids, string $taxonomy ) {
    346         $this->prime_object_term_cache( $object_ids );
    347         return wp_cache_get_multiple( $object_ids, "{$taxonomy}_relationships" );
    348     }
    349 
     337     * @return int[] Array of term IDs with object ID as key.
     338     */
     339    protected function get_from_object_term_cache( array $object_ids, string $taxonomy ): array {
     340        $values = wp_cache_get_multiple( $object_ids, "{$taxonomy}_relationships" );
     341
     342        // If values are missing, then update the cache and replace missed values by freshly cached ones.
     343        $object_terms = $this->update_object_term_cache( $object_ids );
     344        if ( isset( $object_terms[ $taxonomy ] ) ) {
     345            $values = array_replace( $values, $object_terms[ $taxonomy ] );
     346        }
     347
     348        $sanitized_values = array();
     349        foreach ( $values as $object_id => $term_ids ) {
     350            if ( ! is_array( $term_ids ) ) {
     351                continue;
     352            }
     353
     354            $id = reset( $term_ids );
     355            if ( ! is_numeric( $id ) || empty( $id ) ) {
     356                continue;
     357            }
     358
     359            $sanitized_values[ $object_id ] = (int) $id;
     360        }
     361
     362        return $sanitized_values;
     363    }
    350364
    351365    /**
  • polylang/tags/3.8.1/src/translated-object.php

    r3467776 r3486388  
    154154        }
    155155
    156         $this->prime_object_term_cache( array_merge( array( $id ), $translations ) );
     156        $this->update_object_term_cache( array_merge( array( $id ), $translations ) );
    157157
    158158        $lang = $this->get_language( $id );
  • polylang/tags/3.8.1/vendor/composer/installed.php

    r3484589 r3486388  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'ebe3043546cd03a644091bf927c9ea78266fafbf',
     6        'reference' => '86992faee7a54a4b542fa390367d66d1120734d5',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'ebe3043546cd03a644091bf927c9ea78266fafbf',
     16            'reference' => '86992faee7a54a4b542fa390367d66d1120734d5',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
  • polylang/trunk/polylang.php

    r3484589 r3486388  
    1111 * Plugin URI:        https://polylang.pro
    1212 * Description:       Adds multilingual capability to WordPress
    13  * Version:           3.8
     13 * Version:           3.8.1
    1414 * Requires at least: 6.5
    1515 * Requires PHP:      7.4
     
    5454
    5555// Go on loading the plugin.
    56 define( 'POLYLANG_VERSION', '3.8' );
     56define( 'POLYLANG_VERSION', '3.8.1' );
    5757define( 'PLL_MIN_WP_VERSION', '6.5' );
    5858define( 'PLL_MIN_PHP_VERSION', '7.4' );
  • polylang/trunk/readme.txt

    r3484589 r3486388  
    66Tested up to: 6.9
    77Requires PHP: 7.4
    8 Stable tag: 3.8
     8Stable tag: 3.8.1
    99License: GPLv3 or later
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    105105
    106106== Changelog ==
     107
     108= 3.8.1 (2026-03-19) =
     109
     110* Fix fatal error when the cache is suspended #1837 #1839
    107111
    108112= 3.8 (2026-03-17) =
  • polylang/trunk/src/translatable-object.php

    r3467776 r3486388  
    252252     * @param int[]  $object_ids Array of object IDs.
    253253     * @param string $taxonomy   Taxonomy name.
    254      * @return array<int,WP_Term|null> Array of terms with object ID as key.
     254     * @return array<int,WP_Term> Array of terms with object ID as key.
    255255     */
    256256    protected function get_object_terms( array $object_ids, string $taxonomy ) {
     
    262262        $cached_values = $this->get_from_object_term_cache( $object_ids, $taxonomy );
    263263
    264         // Flatten the array to prime the terms cache.
    265         $all_term_ids = array();
    266         foreach ( $cached_values as $term_ids ) {
    267             $all_term_ids = array_merge( $all_term_ids, $term_ids );
    268         }
     264        $all_term_ids = array_values( $cached_values );
    269265        _prime_term_caches( $all_term_ids, false );
    270266
    271267        $terms = array();
    272         foreach ( $cached_values as $object_id => $term_ids ) {
    273             if ( ! empty( $term_ids ) ) {
    274                 $term_id = reset( $term_ids ); // There is only one term for language or translation groups.
    275 
    276                 /** @var WP_Term $term */
    277                 $term                = get_term( $term_id );
    278                 $terms[ $object_id ] = $term;
    279             }
     268        foreach ( $cached_values as $object_id => $term_id ) {
     269            /** @var WP_Term $term */
     270            $term                = get_term( $term_id );
     271            $terms[ $object_id ] = $term;
    280272        }
    281273
     
    286278     * Caches all object-relationship terms.
    287279     *
    288      * @since 3.8
     280     * @since 3.8.1
    289281     *
    290282     * @param int[] $object_ids Array of object IDs.
    291283     *
    292      * @return void
    293      */
    294     protected function prime_object_term_cache( array $object_ids ) {
     284     * @return int[][][]
     285     */
     286    protected function update_object_term_cache( array $object_ids ) {
    295287        $non_cached_ids = array();
    296288        foreach ( $this->tax_to_cache as $tax ) {
     
    299291
    300292        if ( empty( $non_cached_ids ) ) {
    301             return;
     293            return array();
    302294        }
    303295
     
    312304
    313305        if ( ! is_array( $terms ) ) {
    314             return;
     306            return array();
    315307        }
    316308
     
    331323            wp_cache_add_multiple( $data, "{$tax}_relationships" );
    332324        }
     325
     326        return $object_terms;
    333327    }
    334328
     
    341335     * @param string $taxonomy   Taxonomy name.
    342336     *
    343      * @return int[][]
    344      */
    345     protected function get_from_object_term_cache( array $object_ids, string $taxonomy ) {
    346         $this->prime_object_term_cache( $object_ids );
    347         return wp_cache_get_multiple( $object_ids, "{$taxonomy}_relationships" );
    348     }
    349 
     337     * @return int[] Array of term IDs with object ID as key.
     338     */
     339    protected function get_from_object_term_cache( array $object_ids, string $taxonomy ): array {
     340        $values = wp_cache_get_multiple( $object_ids, "{$taxonomy}_relationships" );
     341
     342        // If values are missing, then update the cache and replace missed values by freshly cached ones.
     343        $object_terms = $this->update_object_term_cache( $object_ids );
     344        if ( isset( $object_terms[ $taxonomy ] ) ) {
     345            $values = array_replace( $values, $object_terms[ $taxonomy ] );
     346        }
     347
     348        $sanitized_values = array();
     349        foreach ( $values as $object_id => $term_ids ) {
     350            if ( ! is_array( $term_ids ) ) {
     351                continue;
     352            }
     353
     354            $id = reset( $term_ids );
     355            if ( ! is_numeric( $id ) || empty( $id ) ) {
     356                continue;
     357            }
     358
     359            $sanitized_values[ $object_id ] = (int) $id;
     360        }
     361
     362        return $sanitized_values;
     363    }
    350364
    351365    /**
  • polylang/trunk/src/translated-object.php

    r3467776 r3486388  
    154154        }
    155155
    156         $this->prime_object_term_cache( array_merge( array( $id ), $translations ) );
     156        $this->update_object_term_cache( array_merge( array( $id ), $translations ) );
    157157
    158158        $lang = $this->get_language( $id );
  • polylang/trunk/vendor/composer/installed.php

    r3484589 r3486388  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'ebe3043546cd03a644091bf927c9ea78266fafbf',
     6        'reference' => '86992faee7a54a4b542fa390367d66d1120734d5',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'ebe3043546cd03a644091bf927c9ea78266fafbf',
     16            'reference' => '86992faee7a54a4b542fa390367d66d1120734d5',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.