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

CLI only fires wp2static_post_deploy_trigger if there are deploy add-ons #843

Closed
3 tasks done
michaelfig opened this issue Dec 12, 2021 · 3 comments
Closed
3 tasks done
Assignees
Labels

Comments

@michaelfig
Copy link

Before creating an issue / filing a support request

  • try to troubleshoot the issue yourself (see Troubleshooting guide)
  • prepare as much information as possible to help the developer
  • Identify the issue as likely: WP2Static bug

Describe the bug
wp2static_post_deploy_trigger is not fired via CLI when there are no deploy add-ons.

To Reproduce
Steps to reproduce the behavior:

  1. Use the following code:
add_action('wp2static_post_deploy_trigger', 'foo');
function foo() {
  exec('/usr/local/bin/foo.sh');
}

and in /usr/local/bin/foo.sh:

#! /bin/sh
date >> /tmp/foo.log
  1. Choose WP2Static / Run without any deployment plugins enabled.
  2. Note that a line is written to /tmp/foo.log
  3. Run wp wp2static deploy
  4. Note that nothing new is added to /tmp/foo.log

Expected behavior
Expected the trigger to fire both times.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Hosting OS: Ubuntu Focal
  • Web server setup: Apache
  • Hosting company: local computer

Additional context

The following patch makes things work the way I'd expect:

--- wp2static/src/CLI.php.orig  2021-12-12 22:16:06.880991836 +0000
+++ wp2static/src/CLI.php       2021-12-12 22:04:13.904867609 +0000
@@ -113,8 +113,8 @@
         } else {
             WsLog::l( 'Starting deployment' );
             do_action( 'wp2static_deploy', ProcessedSite::getPath(), $deployer );
-            do_action( 'wp2static_post_deploy_trigger', $deployer );
         }
+        do_action( 'wp2static_post_deploy_trigger', $deployer );
     }
 
     /**

Add any other context about the problem here.

Thanks for WP2Static. It's really great!

@john-shaffer
Copy link
Contributor

john-shaffer commented Dec 14, 2021

Can you help us understand your use case here? Would a new action do the trick?

@michaelfig
Copy link
Author

Can you help us understand your use case here? Would a new action do the trick?

I want to run a trigger whenever a deployment happens, so I can deploy the processed files via the netlify command line (I need this for some Netlify Functions to be part of the bundle). For the WP button, this works fine. But when I run wp wp2static deploy it doesn't behave the same.

A new action would work, but it still seems strange that the existing wp2static_post_deploy_trigger behaves differently in those two contexts.

@john-shaffer
Copy link
Contributor

Thanks! This will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants