-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Streamline and enhance the plugin load procedure #260
Conversation
jenkins test this please |
@seamuslee001 Can you help me a bit here? I can build with buildkit, but am unsure how to run the E2E tests locally. While a very minor functional change, this has a great deal of cleanup and I'd like to find out what is triggering the test failures. |
This is the error I get
for:
|
Hmm, hopefully 5d8bef7 fixes the failure. |
Jenkins re test this please |
Hmm, looking at the console output, it seems like this step is throwing a fatal error: wp eval '$c=[civi_wp(), "add_wpload_setting"]; if (is_callable($c)) $c();' Which is odd because the currently-targeted Ah, hold on... I think I see what's going on... What's going is that I think 1b0d4f0 should fix the above error. @seamuslee001 Does the Jenkins script need updating perhaps? From what I can tell, the above statement should be replaced with something like: wp eval '$c=[civi_wp()->admin, "add_wpload_setting"]; if (is_callable($c)) $c();'
wp eval '$c=[civi_wp()->basepage, "create_wp_basepage"]; if (is_callable($c)) $c();' This would set both the |
Jenkins re test this please |
@seamuslee001 The current error seems unrelated:
Any ideas? |
@christianwach that is fine (that should happen in the Karma tests) but the problem seems to be about the insertion of a new setting group not having a default value or something. thoughts @totten |
@seamuslee001 @totten The key change in the code here is that I switch the way the |
00ecedc
to
461b7e0
Compare
461b7e0 reverts the way in which the |
@totten Do you have any insights on hwy tests are failing on this PR? I cannot seem to figure it out. |
@kcristiano @totten I've made a couple of force-pushed changes to avoid what seem to be changes in the way that I'm still stumped why the tests are failing. |
@christianwach that thing about the optional before required is actually not Civilint but php8, the test boxes now have php8 on as the PR testing version of php |
Jenkins re test this please |
Now that there's a recent test success to compare against, diffing the console output of this and #264 shows the failure being @kcristiano @seamuslee001 @totten Anyone know what this means and how I can debug what's going on? |
That looks to like
The setting is defined https://github.com/civicrm/civicrm-core/blame/0d0eca748e1bf13765cc6ade8cf7bd9ad5800557/settings/Core.setting.php#L905 and gropu is set to I am hoping others can get into more detail. |
related civicrm/civicrm-buildkit#664 |
Jenkins re test this please |
Looks like the buildkit fix didn't help here - any way we can see why the 4.6.36 upgrade is failing? I'd like to get past this as I had hoped we'd have this in 5.45 but we've missed that. |
* If we don't have a setting, create it. Also set it if it's different to | ||
* what's stored. This could be because we've changed server or location. | ||
*/ | ||
if (empty($setting) || $setting !== $path) { | ||
CRM_Core_BAO_Setting::setItem($path, 'CiviCRM Preferences', 'wpLoadPhp'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if we change this to be
CRM_Core_BAO_Setting::setItem($path, 'CiviCRM Preferences', 'wpLoadPhp'); | |
Civi::settings()->set('wpLoadPhp', $path); |
Not sure this was addressed directly; just to answer.... The test suite includes a series of database snapshots generated from historical releases (https://github.com/civicrm/civicrm-upgrade-test). IIRC, the PR selects snapshots from 4.6.12 through current; then, for each, it loads the DB and tries to run an upgrade. (The kind of bug that it should call-out involves bootstrap-logic or upgrade-logic which relies on some new service or schema. For example, suppose v5.75.0 adds an entity To reproduce, I think you could manually load the snapshot DB and run ## Run upgrade with a specific DB snapshot
civibuild upgrade-test wpmaster 4.6.36-setupsh.sql.bz2
civibuild upgrade-test wpmaster /path/to/buildkit/vendor/civicrm/upgrade-test/databases/4.6.36-setupsh.sql.bz2
## Run all DB snapshots between 4.6.12 and 4.7.0
civi-test-run -j /tmp/junit -b wpmaster upgrade@4.6.12..4.7.0 FWIW, I can confirm that I get a similar failure when running locally. |
@totten my finding was that because we are now trying to set the setting before we start the upgrade that this if fails and as such https://github.com/civicrm/civicrm-core/blob/master/Civi/Core/SettingsBag.php#L419 group_name doesn't get applied to the insert SQL |
@totten Thanks for the anlaysis I'll try and look over the next few days. I've also determined that we had put a work around in buildkit https://github.com/civicrm/civicrm-buildkit/blame/master/app/config/wp-demo/install.sh#L60 However, this PR fixes this and that line causes a fatal error in te tests as far as I can see. I was attempting to do a regex to add logic to only run if the version is less than or equal to 5.45, but so far my regex fails. I can get the logic to not run that line if I'll also take a look at resolving the merge conflicts in wp-cli as I do want the clean up that was done in this PR. Any guidance on the regex to get a string version the is |
For version comparisons in bash -- I've found it more effective to pass over to PHP's if cv ev 'exit(version_compare(CRM_Utils_System::version(), "4.7.0", "<") ?0:1);' ; then
cv api setting.create versionCheck=0 debug=1
fi But that example uses Perhaps something like this: ###############################################################################
## Compare the current Civi source-version to some reference amount
##
## usage: civicrm_compare_ver OPERATOR REFERENCE_VER
## ex: if civicrm_compare_ver '<' '5.20' ; then
function civicrm_compare_ver() {
env ME=$(civicrm_get_ver "$CIVI_ROOT") \
OP="$1" \
REF="$2" \
php -r 'exit(version_compare(getenv("ME"),getenv("REF"),getenv("OP"))?0:1);'
return $?
}
if civicrm_compare_ver '<' '5.20' ; then echo "Less than 5.20" ; else echo "More than 5.20" ; fi
if civicrm_compare_ver '>' '5.20' ; then echo "More than 5.20" ; else echo "Less than 5.20" ; fi
if civicrm_compare_ver '<' '5.50' ; then echo "Less than 5.50" ; else echo "More than 5.50" ; fi
if civicrm_compare_ver '>' '5.50' ; then echo "More than 5.50" ; else echo "Less than 5.50" ; fi (NOTE: Edited |
@christianwach christianwach#10 is my attempt to fix the merge conflicts - nver mind - I missed a section. I'll come back to this later. Is it possible to cut this as multiple PRs? The NFC changes and then the load changes? The error that I expected to be due to how we are building the site turned out to be a red herring so I think we need to attack in smaller pieces. |
@christianwach @kcristiano I took a stab at rebasing in #271. |
@christianwach can we close this in favor of #271 |
Merged #271 which replaces this PR |
Overview
This PR should solve a couple of issues on Lab:
It replaces #205 for the above issues.
It also streamlines the plugin load procedure(s):
anonymous_user
role and default capabilities on plugin activation.wp civicrm install
now setswpLoadPhp
and creates the Base Page.It should be noted that there is still work to be done when CiviCRM is configured in "Multi-Domain" mode. The procedures to set up new Domains are more complex than CiviCRM in "WordPress Multisite with multiple separate databases" mode. The Base Page, for example, cannot be identified until the new Domain has been properly set up - because the new CiviCRM Domain reads the "root" Domain's settings until that point.
Having said that, this PR improves the experience for most developers most of the time and should help future progress on streamlining "Multi-Domain" mode.