Skip to content

Commit

Permalink
Promote with Blaze: Purge cache on Atomic sites when site visibility …
Browse files Browse the repository at this point in the history
…changes
  • Loading branch information
BogdanUngureanu committed Dec 17, 2024
1 parent f16ae49 commit 1295d6d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Bring back promote with blaze in post quick links for Atomic sites
3 changes: 2 additions & 1 deletion projects/plugins/jetpack/modules/blaze.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

use Automattic\Jetpack\Blaze;
use Automattic\Jetpack\Status\Host;

Blaze::init();

Expand All @@ -27,7 +28,7 @@
* @return bool
*/
function jetpack_blaze_post_row_actions_disable( $are_quick_links_enabled, $post ) {
if ( 'product' !== $post->post_type ) {
if ( 'product' !== $post->post_type && ! ( new Host() )->is_wpcom_platform() ) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Purge the cache when the site visibility changes on Atomic sites
33 changes: 33 additions & 0 deletions projects/plugins/wpcomsh/feature-plugins/blaze.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @package wpcomsh
*/

use Automattic\Jetpack\Connection\Manager as Jetpack_Connection;

/**
* Activate the Blaze module
* If you use a version of Jetpack that supports it,
Expand Down Expand Up @@ -61,5 +63,36 @@ function wpcomsh_activate_blaze_module_on_launching( $old_value, $new_value ) {
if ( $blog_public === 1 ) {
wpcomsh_activate_blaze_module();
}

return $new_value;
}
add_filter( 'update_option_blog_public', 'wpcomsh_activate_blaze_module_on_launching', 10, 2 );

/**
* Delete the transient for the given site id.
*
* @return void
*/
function wpcomsh_blaze_purge_transient_cache() {
$transient = 'jetpack_blaze_site_supports_blaze_' . Jetpack_Connection::get_site_id();
error_log('cache deleted!!' . Jetpack_Connection::get_site_id() );

Check warning on line 78 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

error_log() found. Debug code should not normally be used in production. (WordPress.PHP.DevelopmentFunctions.error_log_error_log)

Check failure on line 78 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket)

Check failure on line 78 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Concat operator must be surrounded by a single space (Squiz.Strings.ConcatenationSpacing.PaddingFound)

delete_transient( $transient );
}

/**
* Delete the caching transient when coming soon is changed.
*/
add_action('pre_update_option_wpcom_public_coming_soon', function($option) {

Check failure on line 86 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Opening parenthesis of a multi-line function call must be the last content on the line (PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket)

Check failure on line 86 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Only one argument is allowed per line in a multi-line function call (PEAR.Functions.FunctionCallSignature.MultipleArguments)

Check failure on line 86 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Expected 1 space after FUNCTION keyword; 0 found (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)

Check failure on line 86 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Expected 1 spaces after opening parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen)

Check failure on line 86 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Expected 1 spaces before closing parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose)
wpcomsh_blaze_purge_transient_cache();
return $option;
});

Check failure on line 89 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Closing parenthesis of a multi-line function call must be on a line by itself (PEAR.Functions.FunctionCallSignature.CloseBracketLine)

/**
* Delete the caching transient when the blog visibility option changes.
*/
add_action('pre_update_option_blog_public', function($option) {

Check failure on line 94 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Opening parenthesis of a multi-line function call must be the last content on the line (PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket)

Check failure on line 94 in projects/plugins/wpcomsh/feature-plugins/blaze.php

View workflow job for this annotation

GitHub Actions / PHP Code Sniffer (non-excluded files only)

Only one argument is allowed per line in a multi-line function call (PEAR.Functions.FunctionCallSignature.MultipleArguments)
wpcomsh_blaze_purge_transient_cache();

return $option;
});

0 comments on commit 1295d6d

Please sign in to comment.