Skip to content

Commit

Permalink
Super Cache: notify Boost that migration is in progress (#37797)
Browse files Browse the repository at this point in the history
* Fire "jb_cache_moved_to_boost" action when migrating to Boost

Fixes  #37742

* changelog

* An action may not be hooked if Boost is not connected.

Use a transient that can be checked after connection.

* Don't call the migration notifier, that's for another PR.

* Update versions from trunk

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/9500726767

Upstream-Ref: Automattic/jetpack@737253c
  • Loading branch information
dilirity authored and matticbot committed Jun 13, 2024
1 parent 6cf9ba0 commit a58a140
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 13 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.12.2-alpha] - unreleased
## [1.13.0-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Added
- Super Cache: notify Boost of migration to that plugin

### Changed
- Super Cache: tell user that Cache module of Boost must be deactivated to use WPSC
- Updated package dependencies.
Expand Down Expand Up @@ -742,7 +745,7 @@ This is an alpha version! The changes listed here are not final.

Misc fixes

[1.12.2-alpha]: https://github.com/Automattic/wp-super-cache/compare/v1.12.1...v1.12.2-alpha
[1.13.0-alpha]: https://github.com/Automattic/wp-super-cache/compare/v1.12.1...v1.13.0-alpha
[1.12.1]: https://github.com/Automattic/wp-super-cache/compare/v1.12.0...v1.12.1
[1.12.0]: https://github.com/Automattic/wp-super-cache/compare/v1.11.0...v1.12.0
[1.11.0]: https://github.com/Automattic/wp-super-cache/compare/v1.10.0...v1.11.0
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"wp-svn-autopublish": true
},
"config": {
"autoloader-suffix": "6fe342bc02f0b440f7b3c8d8ade42286_super_cacheⓥ1_12_2_alpha"
"autoloader-suffix": "6fe342bc02f0b440f7b3c8d8ade42286_super_cacheⓥ1_13_0_alpha"
}
}
14 changes: 13 additions & 1 deletion inc/boost.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@ function wpsc_track_move_from_boost() {

do_action( 'jb_cache_moved_to_wpsc' );
}
add_action( 'wpsc_created_advanced_cache', 'wpsc_track_move_from_boost' );
add_action( 'wpsc_created_advanced_cache', 'wpsc_track_move_from_boost' );

/**
* Notify Jetpack Boost that Boost Cache will be used instead of WP Super Cache.
*
* @param string $source The source of the migration: 'notice', 'banner', 'try_button'.
*/
function wpsc_notify_migration_to_boost( $source ) {
if ( ! in_array( $source, array( 'notice', 'banner', 'try_button' ), true ) ) {
return;
}
set_transient( 'jb_cache_moved_to_boost', $source, WEEK_IN_SECONDS );
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-super-cache",
"version": "1.12.2-alpha",
"version": "1.13.0-alpha",
"description": "A very fast caching engine for WordPress that produces static html files.",
"homepage": "https://jetpack.com",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_12_2_alpha::getLoader();
return ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_13_0_alpha::getLoader();
8 changes: 4 additions & 4 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_12_2_alpha
class ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_13_0_alpha
{
private static $loader;

Expand All @@ -24,12 +24,12 @@ public static function getLoader()

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cacheⓥ1_12_2_alpha', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cacheⓥ1_13_0_alpha', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cacheⓥ1_12_2_alpha', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit6fe342bc02f0b440f7b3c8d8ade42286_super_cacheⓥ1_13_0_alpha', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_12_2_alpha::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_13_0_alpha::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_12_2_alpha
class ComposerStaticInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_13_0_alpha
{
public static $classMap = array (
'Automattic\\Jetpack\\Device_Detection' => __DIR__ . '/..' . '/automattic/jetpack-device-detection/src/class-device-detection.php',
Expand All @@ -15,7 +15,7 @@ class ComposerStaticInit6fe342bc02f0b440f7b3c8d8ade42286_super_cacheⓥ1_12_2_al
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->classMap = ComposerStaticInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_12_2_alpha::$classMap;
$loader->classMap = ComposerStaticInit6fe342bc02f0b440f7b3c8d8ade42286_super_cache1_13_0_alpha::$classMap;

}, null, ClassLoader::class);
}
Expand Down
2 changes: 1 addition & 1 deletion wp-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP Super Cache
* Plugin URI: https://wordpress.org/plugins/wp-super-cache/
* Description: Very fast caching plugin for WordPress.
* Version: 1.12.2-alpha
* Version: 1.13.0-alpha
* Author: Automattic
* Author URI: https://automattic.com/
* License: GPL2+
Expand Down

0 comments on commit a58a140

Please sign in to comment.