-
-
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
Merge REST API wrapper code #160
Conversation
wp-rest php7.0 compatible
make strings translatable
Thank you @christianwach! I've opened an issue/proposal here to introduce a hook to alter the |
@christianwach @mecachisenros I have added this PR to 5.16-RC for testing. We can run through the grid https://lab.civicrm.org/dev/rc/issues/7 to ensure that these changes do not affect existing functionality. Do you have guidance on testing the new endpoints? We've also added the ability to run unit tests on this repo - What type of test coverage can we get on this? |
@MegaphoneJon I've been testing this on the RC builds and I am not finding it hijacking any of the existing REST routes. I believe you use them in WP for a number of use cases, would you be able to take a look at this and test? |
@kcristiano I don't have an active use case for this - it bit my GSoC student last summer, but that's the extent of my interest. However, I'm pretty sure @highfalutin will want to take a look at this. |
Actually - an unrelated issue on an AGH extension just now made me realize that I do use the REST API on WP - it's part of my monitoring regime. It's only one use case, but I can roll this out to a couple of test sites that are under monitoring to make sure they're unaffected. Time permitting, I can also try modifying my check script to use the new endpoint. |
@kcristiano @christianwach OK, just finished testing. The good news: Applying this patch had no effect on making REST calls through the |
@MegaphoneJon Nice catch, thanks Jon! @mecachisenros You probably know better than me how best to implement this -- FWIW it's already being done prior to invoking the CiviCRM UI and prior to calling the CiviCRM API via WP-CLI. Both methods then reset the timezone afterwards here and here. |
@MegaphoneJon @christianwach @kcristiano thank you for the tests and pointers!! @christianwach I've submitted a PR to address it, let me know if it makes sense. |
handle timestamps mismatched system error, CRM-12523/CRM-18062/CRM-19115
I'm happy to test this on our live site, including the mailing URL replacements. Would that be helpful? We're running 5.13.5. |
@bhahumanists that would be great! |
Always format the result! If we call the 'rest' endpoint without json param we are getting the error in json format instead of the expected xml format.
Standardise error responses for the rest endpoint
This is installed and running without issue on our site (humanism.org.uk if you want to check anything). The new civi endpoints are exposed correctly. I'll turn on URL replacements next. |
I applied this on a site that used the REST API (and was having issues with quotes, similar to https://lab.civicrm.org/dev/core/issues/426) and this solution seems to work well (with the new endpoints). |
Jenkins re test this please |
Is the only blocker for this to be merged the documentation update? |
related: civicrm/civicrm-core#15475 @jusfreeman I see the current blocker
Once the technical blocker is gone, we need to get the documentation PR submitted. As merging this in will add the burden of maintenance, I want to see 'concept approved' on https://lab.civicrm.org/dev/wordpress/issues/20 All that said, I do want this merged. We've been running this on our client sites for some time now. |
Prevent clash with CiviCRM WP REST plugin
Adds the 'civi_wp_rest/controller/rest/permissions_check' filter
Adds support for 'hook_civicrm_alterExternUrl' and adds a 'civi_wp_rest/plugin/replace_mailing_tracking_urls' filter
Minor fixes
jenkins test this please |
Unrelated test fail |
jenkins test this please |
Log in and set CiviCRM user session variables user before dispatching rest response
Have had this i production for quite some time. Did another |
Docs PR - civicrm/civicrm-dev-docs#782 |
Overview
Merges the CiviCRM WP REST API Wrapper written by @mecachisenros into the CiviCRM WordPress plugin.
This is the first step towards dropping support for all the scripts in CiviCRM's
extern
directory so that CiviCRM will no longer need to try and bootstrap WordPress.Before
There were no WordPress routes for CiviCRM scripts in
extern
.After
There are now WordPress routes for CiviCRM scripts in
extern
.Technical Details
See the CiviCRM WP REST API Wrapper readme for technical details. A copy of this readme is included in the PR and will be updated to reflect the new context for the code.
Comments
Although this PR means that the REST routes will be available upon merging, it should be noted that this is merely the first step towards stripping out all the directory-traversal code in CiviCRM Core which tries to locate:
wp-load.php
civicrm.settings.php
As has been discussed over the years, this code is unreliable. With the completion of all replacement REST routes, it will also become redundant.
Huge thanks to @mecachisenros for his work on this!