Query Monitor plugin - adding a symlink to Capistrano deploy script

I don’t know much about Ruby.

The WP Query Monitor plugins required a symlinked db.php file, in the wp-content folder, pointing to a file in the plugin folder. As explained here:

Of course, I can add this manually, but how do I achieve this in the deploy.rb script?

This is the symlink command that I’d need to reproduce…

ln -s /path/to/wordpress/wp-content/plugins/query-monitor/wp-content/db.php /path/to/wordpress/wp-content/db.php

You get the idea…



Which script? Not sure what you’re using based on this topic

Sorry Ben. I’m being a bit lazy.

I’m using the Capistrano deployment approach - not Trellis.

Accordingly, it’s the deploy.rb file that’s used with Capistrano.

It has a line in it like so:

set :linked_files, fetch(:linked_files, []).push('.env')

I don’t really understand the syntax, but I’m looking - I think! - to add to this line.

Does that help?


For anyone stumbling on this again. I added the following script to the build-after.yml deploy hook and it worked great:

- name: Create Symlink for Query Monitor
  command: wp qm enable
    chdir: "{{ deploy_helper.new_release_path }}"