Skip to content

Commit 6cd56d8

Browse files
committed
debug
1 parent 6e5ecdf commit 6cd56d8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

features/cache-patch.feature

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ Feature: Patch command available for the object cache
66
"""php
77
<?php
88
$set_foo = function(){
9-
//TODO: DEBUG, remove before merging branch.
10-
WP_CLI::log( var_export( wp_cache_set( 'my_key', ['foo' => 'bar'] ), true ) );
11-
WP_CLI::log( var_export( wp_cache_set( 'other_key', ['fuz' => 'biz'] ), true ) );
9+
wp_cache_set( 'my_key', ['foo' => 'bar'] );
10+
wp_cache_set( 'other_key', ['fuz' => 'biz'] );
1211
1312
$complex_key = (object) [
1413
'foo' => (object) [

src/Cache/RecursiveDataStructureTraverser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public function delete( $key_path ) {
9292
* @param mixed $value
9393
*/
9494
public function insert( $key_path, $value ) {
95+
\WP_CLI::log( var_export( [$key_path, $value], true ) );
9596
try {
9697
$this->update( $key_path, $value );
9798
} catch ( NonExistentKeyException $exception ) {

src/Cache_Command.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ public function patch( $args, $assoc_args ) {
517517
$group = Utils\get_flag_value( $assoc_args, 'group' );
518518
$expiration = Utils\get_flag_value( $assoc_args, 'expiration' );
519519

520+
\WP_CLI::log( var_export( [ $action, $key ], true ) );
521+
520522
$key_path = array_map(
521523
function ( $key ) {
522524
if ( is_numeric( $key ) && ( (string) intval( $key ) === $key ) ) {
@@ -528,14 +530,20 @@ function ( $key ) {
528530
array_slice( $args, 2 )
529531
);
530532

533+
\WP_CLI::log( var_export( $key_path, true ) );
534+
531535
if ( 'delete' === $action ) {
532536
$patch_value = null;
533537
} elseif ( \WP_CLI\Entity\Utils::has_stdin() ) {
534538
$stdin_value = WP_CLI::get_value_from_arg_or_stdin( $args, - 1 );
535539
$patch_value = WP_CLI::read_value( trim( $stdin_value ), $assoc_args );
540+
\WP_CLI::log( 'STDIN : ' . var_export( $key_path, true ) );
541+
\WP_CLI::log( 'STDIN : ' . var_export( $patch_value, true ) );
536542
} else {
537543
// Take the patch value as the last positional argument. Mutates $key_path to be 1 element shorter!
538544
$patch_value = WP_CLI::read_value( array_pop( $key_path ), $assoc_args );
545+
\WP_CLI::log( 'NO STDIN : ' . var_export( $key_path, true ) );
546+
\WP_CLI::log( 'NO STDIN : ' . var_export( $patch_value, true ) );
539547
}
540548

541549
/* Need to make a copy of $current_value here as it is modified by reference */

0 commit comments

Comments
 (0)