Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDPT-2259 Revert get before delete - because even GET requests for missing docs. log 404s. #784

Merged
merged 1 commit into from
Nov 19, 2024
Merged
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
22 changes: 0 additions & 22 deletions bin/composer-post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,3 @@ if grep -q $TREE_VIEW_SEARCH $TREE_VIEW_FILE ; then
echo "Fixing warning in cms-tree-page-view..."
sed -i "s/$TREE_VIEW_SEARCH/$TREE_VIEW_REPLACE/g" $TREE_VIEW_FILE
fi


# This find/replace is for the ElasticPress plugin.
#
# When a new post is created via the WordPress dashboard, the existing behaviour of the ElasticPress plugin
# is to delete the post from the search index. Delteing a post that's not in the index causes a 404 error to
# be logged on Cloud Platform's OpenSearch proxy server.
#
# This change adds a check to see if the post is in the index before deleting it, preventing the 404 error.

ELASTIC_PRESS_TARGET_VERSION="5.1.3"
verify_composer_package_version "wpackagist-plugin/elasticpress" $ELASTIC_PRESS_TARGET_VERSION

ELASTIC_PRESS_FILE=/var/www/html/public/app/mu-plugins/elasticpress/includes/classes/Indexable/Post/SyncManager.php
ELASTIC_PRESS_SEARCH="\t\$this->action_delete_post( \$post_id );"
ELASTIC_PRESS_REPLACE="\t\/\/ The following line was modified by composer-post-install.sh\n\t\t"
ELASTIC_PRESS_REPLACE="$ELASTIC_PRESS_REPLACE\t\$indexable->get( \$post_id ) \&\& \$this->action_delete_post( \$post_id );"

if [ -f "$ELASTIC_PRESS_FILE" ] ; then
echo "Fixing warning in elasticpress. Checking for doc before deleting prevents 404s in logs..."
sed -i "s/$ELASTIC_PRESS_SEARCH/$ELASTIC_PRESS_REPLACE/g" $ELASTIC_PRESS_FILE
fi
Loading