Skip to content

Commit

Permalink
Update composer-post-install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
EarthlingDavey committed Nov 18, 2024
1 parent 99344b0 commit 1650faa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/composer-post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,18 @@ fi
ELASTIC_PRESS_TARGET_PACKAGE="wpackagist-plugin/elasticpress"
ELASTIC_PRESS_TARGET_VERSION="5.1.3"
ELASTIC_PRESS_INSTALLED_VERSION=$(get_installed_version $ELASTIC_PRESS_TARGET_PACKAGE)
# Variables for the find and replace.
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\$indexable->get( \$post_id ) \&\& \$this->action_delete_post( \$post_id );"

# If the target version is not inatalled then exit.
if [ "$ELASTIC_PRESS_INSTALLED_VERSION" != "$ELASTIC_PRESS_TARGET_VERSION" ] ; then
echo "Elasticpress target version is not installed - review composer-post-install.sh."
exit 1;
fi

# Variables for the find and replace.
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\$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
Expand Down

0 comments on commit 1650faa

Please sign in to comment.