Skip to content
Snippets Groups Projects
Commit 7c5b1a36 authored by Dyszczo's avatar Dyszczo
Browse files

Merge branch 'fix/wc_untested' into 'master'

fix(plugin_data): #13 in woocommerce-quick-cross-sells. WC tested shows invalid info

See merge request !26
parents abf5fb85 5c319e8b
No related branches found
No related tags found
1 merge request!26fix(plugin_data): #13 in woocommerce-quick-cross-sells. WC tested shows invalid info
Pipeline #10629 passed
## [3.2.3] - 2020-10-05
### Fixed
- WC tested shows invalid info
## [3.2.2] - 2019-12-17
### Fixed
- Plugin version should be checked only in needed
......
......@@ -303,8 +303,10 @@
if ( count( $required_plugins ) > 0 ) {
foreach ( $required_plugins as $plugin ) {
if ( version_compare( $plugin['Version'], $plugin[ self::PLUGIN_INFO_APPEND_PLUGIN_DATA ], '<' ) ) {
$notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin requires at least %s version of %s to work correctly. Please update it', $this->get_text_domain() ),
esc_html( $this->plugin_name ), $plugin[ self::PLUGIN_INFO_APPEND_PLUGIN_DATA ], $plugin[ 'Name' ] ) );
$notices[] = $this->prepare_notice_message( sprintf( __( 'The &#8220;%s&#8221; plugin requires at least %s version of %s to work correctly. Please update it',
$this->get_text_domain() ),
esc_html( $this->plugin_name ), $plugin[ self::PLUGIN_INFO_APPEND_PLUGIN_DATA ],
$plugin['Name'] ) );
}
}
}
......@@ -318,6 +320,18 @@
* @return array In format [ 'plugindir/pluginfile.php' => ['Name' => 'Plugin Name', 'Version' => '1.0.1', ...], ]
*/
private static function retrieve_plugins_data_in_transient() {
static $never_executed = true;
if ( $never_executed ) {
$never_executed = false;
/** Required when WC starts later and these data should be in cache */
add_filter( 'extra_plugin_headers', function ( $headers = array() ) {
$headers[] = 'WC tested up to';
$headers[] = 'WC requires at least';
$headers[] = 'Woo';
return array_unique( $headers );
} );
}
$plugins = get_transient( self::PLUGIN_INFO_TRANSIENT_NAME );
......@@ -327,7 +341,8 @@
}
$plugins = function_exists( 'get_plugins' ) ? get_plugins() : array();
set_transient( self::PLUGIN_INFO_TRANSIENT_NAME, $plugins, self::PLUGIN_INFO_TRANSIENT_EXPIRATION_TIME );
set_transient( self::PLUGIN_INFO_TRANSIENT_NAME, $plugins,
self::PLUGIN_INFO_TRANSIENT_EXPIRATION_TIME );
}
return $plugins;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment