Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into fix/expiration-arg
  • Loading branch information
swissspidy committed Nov 2, 2025
commit 2ea92ae1bbdc6f79455b11edc52a2e466fdfa7a0
6 changes: 4 additions & 2 deletions src/Cache_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,10 @@
*/
public function patch( $args, $assoc_args ) {
list( $action, $key ) = $args;
$group = Utils\get_flag_value( $assoc_args, 'group' );
$expiration = (int) Utils\get_flag_value( $assoc_args, 'expiration' );

$group = Utils\get_flag_value( $assoc_args, 'group' );

$expiration = (int) Utils\get_flag_value( $assoc_args, 'expiration' );

$key_path = array_map(
function ( $key ) {
Expand Down Expand Up @@ -602,7 +604,7 @@
if ( $patched_value === $old_value ) {
WP_CLI::success( "Value passed for cache key '$key' is unchanged." );
} else {
$success = wp_cache_set( $key, $patched_value, $group, (int) $expiration );

Check failure on line 607 in src/Cache_Command.php

View workflow job for this annotation

GitHub Actions / code-quality / PHPStan

Casting to int something that's already int.
if ( $success ) {
WP_CLI::success( "Updated cache key '$key'." );
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/Transient_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ function ( $key ) {
*/
public function patch( $args, $assoc_args ) {
list( $action, $key ) = $args;
$expiration = (int) Utils\get_flag_value( $assoc_args, 'expiration' );

$expiration = (int) Utils\get_flag_value( $assoc_args, 'expiration', 0 );

$read_func = Utils\get_flag_value( $assoc_args, 'network' ) ? 'get_site_transient' : 'get_transient';
$write_func = Utils\get_flag_value( $assoc_args, 'network' ) ? 'set_site_transient' : 'set_transient';
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.