Open cliffordp opened 4 years ago
@cliffordp I'm not sure I understand the problem.
The file does contain defensive coding for ABSPATH
and will return without doing anything if ABSPATH
is not defined.
If ABSPATH
is defined, WP must be loaded, so did_action()
should be available.
Only thing I can think of is that that code may not be in the last release. It is in the file in master
.
I've got v2.6.1 as confirmed by PhpStorm in this screenshot, which is the latest version from https://packagist.org/packages/tgmpa/tgm-plugin-activation
I see neither v2.6.1 nor master have the ABSPATH check that's present in develop.
Adding that check from develop does fix the issue with my tests. Sounds like a version bump would be the path forward. Thanks for the quick help! :)
@jrfnl any idea why https://packagist.org/packages/tgmpa/tgm-plugin-activation has v2.6.1 as latest version still - no version bump yet? Using dev-develop
instead is of risk since I don't know what goes into there compared to an official release.
@cliffordp Because that is the latest version. See my previous answer to you about releasing a new version: https://github.com/TGMPA/TGM-Plugin-Activation/issues/741#issuecomment-488142682
Also, you can see exactly what has changed between the last release and develop
:
I understand. How can we get 2.6.2 (or whatever other number, such as 2.6.1.1) released that ONLY has the defensive coding for ABSPATH
so dev-develop can be a development branch but Composer installs (including GitHub Actions tests) can specify a version number?
See my previous answer and no, that will not be a release just with that fix.
boo 😜
thanks for the quick, thorough help nonetheless. appreciate ya!
One workaround is to use the git repository:
"repositories": [
{
"type": "package",
"package": {
"name": "tgm/plugin-activation",
"version": "2.6.1",
"source": {
"url": "https://github.com/TGMPA/TGM-Plugin-Activation.git",
"type": "git",
"reference": "master"
}
}
}
],
And then require the latest:
"require": {
"tgmpa/tgm-plugin-activation": "*",
},
Or, you could define dependency on tgmpa/tgm-plugin-activation:dev-develop
to get latest develop
branch, provided you have minimum-stability
set to dev
.
Re: https://github.com/TGMPA/TGM-Plugin-Activation/blob/develop/composer.json#L36-L38
Force-loading this file causes errors when running Codeception tests on a plugin that implements TGMPA, failing because
class-tgm-plugin-activation.php
does not have defensive code ifdid_action
function exists or ifABSPATH
is not defined.Screenshot:
If ☝️ gets fixed, that's when the
ABSPATH
one appears. This has to be fixed in the package because TGMPA is installed via Composer.I'd be willing to submit a PR but am unsure if it'd be received/implemented.
I had bookmarked checking out https://github.com/afragen/wp-dependency-installer anyway so that's what I'm going to try next.