Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 6 additions & 4 deletions lib/integration-adapters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,22 @@ _integration_adapter_verify_managed_release() {
}

_integration_adapter_cleanup_retired_homeboy_option() {
local count
if [ "${DRY_RUN:-false}" = true ]; then
echo -e "${BLUE:-}[dry-run]${NC:-} wp option delete datamachine_code_homeboy_available"
return 0
fi
count="$(wp_cmd option list --search=datamachine_code_homeboy_available --format=count 2>/dev/null || true)"
[ "$count" = 0 ] && return 0
_integration_adapter_retired_homeboy_option_absent && return 0
wp_cmd option delete datamachine_code_homeboy_available >/dev/null 2>&1 || return 1
reconciler_adapter_changed
}

_integration_adapter_verify_retired_homeboy_option() {
[ "${DRY_RUN:-false}" = true ] && return 0
[ "$(wp_cmd option list --search=datamachine_code_homeboy_available --format=count 2>/dev/null)" = 0 ]
_integration_adapter_retired_homeboy_option_absent
}

_integration_adapter_retired_homeboy_option_absent() {
wp_cmd eval '$missing = new stdClass(); exit( $missing === get_option( "datamachine_code_homeboy_available", $missing ) ? 0 : 1 );' >/dev/null 2>&1
}

_integration_adapter_preserve_copied_dmc() {
Expand Down
2 changes: 1 addition & 1 deletion tests/convergence-orchestrator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ configure_homeboy_wordpress_extension() { :; }
homeboy_required() { return 1; }
wp_cmd() {
case "$1 $2" in
'option list') printf '0\n' ;;
eval*) return 0 ;;
*) return 1 ;;
esac
}
Expand Down
9 changes: 3 additions & 6 deletions tests/integration-adapters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ configure_homeboy_wordpress_extension() { printf 'homeboy\n' >> "$HOMEBOY_TRACE"
homeboy_required() { return 1; }
wp_cmd() {
case "$1 $2" in
'option list')
if [ "${3:-}" = '--search=datamachine_code_homeboy_available' ]; then
[ -e "$RETIRED_HOMEBOY_OPTION_STATE" ] && printf '1\n' || printf '0\n'
else
printf '0\n'
fi
'eval $missing = new stdClass(); exit( $missing === get_option( "datamachine_code_homeboy_available", $missing ) ? 0 : 1 );')
printf 'Deprecated: diagnostic text on stdout\n'
[ ! -e "$RETIRED_HOMEBOY_OPTION_STATE" ]
;;
'option delete') rm -f "$RETIRED_HOMEBOY_OPTION_STATE" ;;
'plugin is-active') return 0 ;;
Expand Down
Loading