Skip to content

Instantly share code, notes, and snippets.

@chrisjangl
Created June 21, 2023 17:38
Show Gist options
  • Select an option

  • Save chrisjangl/e7b10ea5bd1fd05ca5de3605987cb652 to your computer and use it in GitHub Desktop.

Select an option

Save chrisjangl/e7b10ea5bd1fd05ca5de3605987cb652 to your computer and use it in GitHub Desktop.

Revisions

  1. chrisjangl created this gist Jun 21, 2023.
    9 changes: 9 additions & 0 deletions deletePlugins.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    for plugin in $(wp --allow-root plugin list --update=available --status=inactive --field=name);
    do
    TITLE=$(wp --allow-root plugin get $plugin --field=title)
    # look into how we can mark the date here. Maybe also only output final result
    rm -r wp-content/plugins/$plugin/* && rmdir wp-content/plugins/$plugin
    git add -A wp-content/plugins/$plugin
    git commit -m "$(printf "delete plugin: $TITLE")"
    echo "$TITLE -> $VERSION" >> ./reports/deleted-plugins.txt
    done;
    9 changes: 9 additions & 0 deletions updatePlugins.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    for plugin in $(wp plugin list --update=available --status=active --field=name);
    do
    TITLE=$(wp plugin get $plugin --field=title)
    wp plugin update $plugin &&
    VERSION=$(wp plugin get $plugin --field=version)
    git add -A wp-content/plugins/$plugin &&
    git commit -m "$(printf "update plugin: $TITLE to $VERSION")"
    echo "$TITLE -> $VERSION" >> updated.txt
    done;