Track changes to options more deeply#573
Conversation
Traverses array members looking for changes
includes/connector.php
Outdated
There was a problem hiding this comment.
Minor nit: Can you please align equals signs here?
There was a problem hiding this comment.
I think the pre-decrement used here is overly tricky. My preference is to only use decrements and increments if they're on their own line. It might be more readable this way.
$deep--;
$changed = self::get_changed_keys( $old_value[ $key ], $new_value[ $key ], $deep );There was a problem hiding this comment.
@fjarrett If you're talking about $deep, i used it so i can control how deep should i check for changes in the array. 0 stands for the first level only ( do not check children at all ), 1 the first level of children, etc .. for options that are stored hierarchically <input name='plugin_name[section][field]' /> .. and since the function is calling itself, i need to decrement the value on each call.
There was a problem hiding this comment.
@shadyvb Oh I get it now, decrementing the value. So $deep-- is the opposite of $deep++, makes sense. I've just never seen it before so it almost seemed like a typo! Thanks for explaining.
|
@shadyvb I've done some basic testing within Stream, and Settings records appear to be working as expected. It would be great to know the specific use-cases I should be testing here that make this PR necessary though. |
Track changes to options more deeply
Traverses array members looking for changes