-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
CRM-19303 - Consolidate getCiviSourceStorage and getDefaultFileStorage functions #9458
Conversation
In no particular order:
My favorite options are probably "scientist" and/or highlighting in the release-notes. |
I agree about the need for testing, but would temper it by noting that:
|
@colemanw We did make changes to deal with problematic symlinking with one host for WordPress. We also needed to make changes to support alternative directory structures. From reading through your changes, I would not expect any issues with WP, but I will need to test out all the use cases I run through. |
@kcristiano it's not easy to tell from the diff, but my change was simply to cut the functions out of |
@colemanw Understood, I expect no changes. However, these functions have been a source of issues before, so I want to test just ensure nothing changes. |
A colleague has tested this PR and found a problem on a Civi 4.7 / Drupal 7 site on a server with a tricky symlink arrangement: Document root is a symlink: Civi is at: Site directory is a symlink: civicrm.settings.php has: /civicrm/admin/setting/path has: Expected result Actual result Another colleague had tried an alternative fix, using Drupal API function conf_path() in CRM/Utils/System/DrupalBase.php . This was successful apart from giving "undefined function" errors on standalone scripts such as /extern/open.php . His feeling is that the right way to fix is to use a Drupal API function to get Drupal's site directory and to fix the standalone scripts so that they bootstrap the CMS to a level just sufficient to get the config. |
@davejenx looking at it what makes you think that patch is incorrect that it identified when its adding /var onto things which makes it consistent with the path settings |
@seamuslee001 It incorrectly identified the URL path to CKEditor conf as /var/sites/mysite.com/files/civicrm/persist/crm-ckeditor-civimail.js , i.e. it tried (and failed) to load mysite.com/var/sites/mysite.com/files/civicrm/persist/crm-ckeditor-default.js - it shouldn't have var/ there. |
Thanks for the testing @davejenx - for comparison, was it working correctly without the patch? |
@colemanw No, it wasn't working correctly without the patch, it was then going to sites/default/ instead of sites/mysite.com/ . |
This has now received some manual testing which all confirms it at least isn't making things worse. To move this along, I propose we merge this change and announce it as an important item to test during the RC phase. |
@colemanw I'd say it arguably does make things worse in the case described in this comment: here the current behaviour is to give a valid URL path under sites/default/ (which allows the workaround of symlinking sites/mysite.com as sites/default) whereas the new behaviour is to give a non-existent URL path. My vote is for your instinct described here:
As noted in my above comment:
Drupal 8 doesn't have conf_path() though, so that would need further effort. |
One quick solution would be to keep this PR and also extend CRM_Utils_Drupal like:
|
@andy-walker @Nafhed Any thoughts on Coleman's suggestion above? |
I'm kind of on the fence. A lot of work has been put into the wordpress version of this function and so far we've only identified one flaw in it (with a tricky symlink arrangement). Maybe we should just fix that bug so all CMSs can benefit from a good working unified function. |
@colemanw Correct me if I am wrong, but one of the reasons not to use CMS specific functions is to ensure we can find CiviCRM when the CMS is not bootstrapped. If my recollection is correct, I'd rather keep your function, but provide a way to override it. Much like we are looking at for CRM-16421 and the civicrm.settings.extra.php file totten suggested the Edale sprint https://gist.github.com/totten/f080b6fa821d1b6c4d6711e750f04cd2 |
My current thinking is that if this function works flawlessly then there is no need to override it using CMS-specific functions and deal with bootstrapping issues. So far one edge-case bug has been identified. @davejenx could you suggest a patch to this PR that would fix it? |
The patch worked for me after a manual install. Thanks |
@colemanw I've tested this patch on Joomla and found some problems.
The above is with the CiviCRM Resource URL set to its default of [civicrm.root]/
On a Dashboard frontend page I'm also getting a datatables error:
Otherwise it does fix the problem in this stackexchange question. of the frontend resource URLs omitting administrator/ when Resource URL setting is set to [civicrm.root]. |
I have just tested this on AUG multisite setup and seems to work as we need |
Just tested this patch (again) on a Drupal/Aegir multisite setup with no issues. |
Just tested on Drupal multi-site and this fixed our issue.👍 |
@eileenmcnaughton @colemanw @totten Eileen, Coleman and Tim, I think this makes more sense in that out at this point, I know AUG has been running this and it fixed it for us but there does appear to be an issue for Joomla. I think we should merge this after the RC is cut and work on the Joomla issue |
Re: @davejenx and this:
This parallels the experience that came up when @kcristiano tried to fix some funny directory structures in WP. It would be easier to implement @kcristiano and I gravitated toward an approach where you write out the boot-critical data to Steps:
This arrangement means:
-- In the interest of full-disclosure, there are theoretically other ways to get access to the CMS utility functions. I view it as a sliding-scale of difficulty/risk:
If someone is actually willing to put a several days dev/test time into making the second one work, then I can write more pointers about that. But otherwise I think the first approach is pretty reasonable. |
@totten I agree - I think we need to define paths and URLs by CMS. I'd like to define these at install using CMS functions. You had detailed an idea at the Edale Spring in 2016 - https://gist.github.com/totten/f080b6fa821d1b6c4d6711e750f04cd2#file-settings-diff-L65 Do you still believe this is the best path forward? We'd end up with civicrm.settings.extra.php as needed? I was planning on creating this for WP (goal would be have it ready for testing by St Louis Sprint). Sounds like we can look at doing this for Drupal and Joomla as well. |
This would be a challenge, but ultimately this (which depends on eliminating remaining standalone scripts) is the only one that will spare us these issues in future IMO. |
This change was to delete the
CRM_Utils_System_Base
version ofgetDefaultFileStorage
andgetCiviSourceStorage
and replace them with the code fromCRM_Utils_System_Wordpress
, which is cleaner & ought to work for every CMS.