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

Plugin exits php when run in script mode #11

Open
apinstein opened this issue Jan 24, 2019 · 3 comments
Open

Plugin exits php when run in script mode #11

apinstein opened this issue Jan 24, 2019 · 3 comments

Comments

@apinstein
Copy link

When using a php script to manipulate a WP install, the force-https plugin will still try to load itself, and the start function will die(), thus making it impossible for the main script to ever execute.

I see a related issue #6 but that seems to be a fix that just detects WP_CLI. In my situation I have a custom CLI script.

My suggestion is that the script should only load itself when not in CLI mode.

@apinstein
Copy link
Author

I should add I tried updating my plugin to 1.3.0 but WP thinks that 1.2.0 is the most current version...

apinstein added a commit to apinstein/force-https that referenced this issue Jan 24, 2019
@jessuppi
Copy link
Member

jessuppi commented Jan 24, 2019

Thanks for the feedback. I'm not sure the entire process you are using, but if you are using a custom script to install WordPress (etc) then you can consider the upcoming defined constants.

These are planned for the next release 1.4.0:

/* Force HTTPS Functions */
define('FORCE_HTTPS', true);
define('FORCE_HTTPS_EXTERNAL_LINKS', false);
define('FORCE_HTTPS_EXTERNAL_RESOURCES', true);
define('FORCE_HTTPS_INTERNAL_LINKS', true);
define('FORCE_HTTPS_INTERNAL_RESOURCES', true);

As the plugin is now hosted on GitHub, the old versions do not detect updates. This will be fixed in future versions that auto-update from this GitHub repo (not WordPress.org).

But I'll have our team take a look at your suggestion re: further support of CLI.

@apinstein
Copy link
Author

I don't think that helps. since you cannot redefine a define constant. A script couldn't leverage those settings to make a difference.

My thinking was that the plugin should basically "skip initializing itself" if the current execution environment isn't a web server.

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

No branches or pull requests

2 participants