Skip to content

Commit

Permalink
3.2.9.9.7 a cache fix in qtranxf_filter_postmeta
Browse files Browse the repository at this point in the history
  • Loading branch information
johnclause committed Apr 30, 2015
1 parent e9a8d6d commit 74f49fb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
4 changes: 2 additions & 2 deletions qtranslate.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: qTranslate-X
Plugin URI: http://wordpress.org/plugins/qtranslate-x/
Description: Adds user-friendly and database-friendly multilingual content support.
Version: 3.2.9.9.6
Version: 3.2.9.9.7
Author: qTranslate Team
Author URI: http://qtranslatexteam.wordpress.com/about
Tags: multilingual, multi, language, admin, tinymce, Polyglot, bilingual, widget, switcher, professional, human, translation, service, qTranslate, zTranslate, mqTranslate, qTranslate Plus, WPML
Expand Down Expand Up @@ -108,7 +108,7 @@
define( 'QTRANSLATE_FILE', __FILE__ );
}

define('QTX_VERSION','3.2.9.9.6');
define('QTX_VERSION','3.2.9.9.7');

require_once(dirname(__FILE__).'/qtranslate_options.php');
require_once(dirname(__FILE__).'/qtranslate_utils.php');
Expand Down
27 changes: 26 additions & 1 deletion qtranslate_frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,33 @@ function qtranxf_filter_postmeta($original_value, $object_id, $meta_key = '', $s
wp_cache_set( $object_id, $meta_cache, $cache_key_lang );
}

if(!$meta_key)
if(!$meta_key){
if($single){
/**
@since 3.2.9.9.7
The code executed after a call to this filter in /wp-includes/meta.php,
in function get_metadata, is apparently designed having non-empty $meta_key in mind:
if ( $single && is_array( $check ) ){
return $check[0];
}else
return $check;
Following the logic of the code "if ( !$meta_key ) return $meta_cache;",
a few lines below in the same function, the code above rather have to be:
if ( $meta_key && $single && is_array( $check ) ){
return $check[0];
}else
return $check;
The line below offsets this imperfection.
If WP ever fixes that place, this block of code will have to be removed.
*/
return array($meta_cache);
}
return $meta_cache;
}

if(isset($meta_cache[$meta_key]))
return $meta_cache[$meta_key];
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ Developers: please drop new topics here, the text will be moved to [qTranslate-X
* Includes all changes after version 3.2.9. Please, review [Release Notes](https://qtranslatexteam.wordpress.com/2015/03/30/release-notes-3-3).
* Translation: a lot of thanks to all translators contributed.

### 3.2.9.9.7 alpha ###
* Fix: one more problem is discovered in function `qtranxf_filter_postmeta` for the case of empty $meta_key, reported in [Issue #138](https://github.com/qTranslate-Team/qtranslate-x/issues/138).

### 3.2.9.9.6 alpha ###
* Enhancement: override admin language from `$_POST['WPLANG']` in case user tries to change language using field 'Site Language' on page `/wp-admin/options-general.php`.
* Fix: action 'updated_postmeta' added to clear post meta data cache: [Issue #138](https://github.com/qTranslate-Team/qtranslate-x/issues/138).
Expand Down

0 comments on commit 74f49fb

Please sign in to comment.